1、Linux挂载Winodws共享文件夹

2、查看http的并发请求数及其TCP连接状态:

3、用tcpdump嗅探80端口的访问看看谁最高

4、统计/var/log/下文件个数

5、查看当前系统每IP连接数

6、shell下32位随机密码生成

7、统计出apache的access.log中访问量最多的5个IP

8、如何查看二进制文件的内容

9、ps aux 中VSZ代表什么意思 RSS代表什么

10、检测并修复/dev/hda5

11、Linux开机启动顺序

12、符号链接和硬链接的区别

13、保存当前磁盘分区的分区表

15、手动安装grub

16、改内核参数

17、在1-39内取随机数

18、限定apache每秒钟连接数为1,峰值为3

19、FTP主动与被动模式

20、显示/etc/inittab中以#开头,且后面跟一个或多个空白字符,而后又跟了任意非空白字符的行;

21、显示/etc/inittab中包含了:一个数字:(即两个冒号中间一个数字)的行;

22、怎么把自己写的脚本添加到服务里面,即可以使用service命令来调用

23、写一个脚本,实现批量添加20个用户,用户名为user1-20,密码为user后面跟5个随机字符

24、写一个脚本,实现判断192.168.1.0/24网络里,当前在线的IP有哪些,能ping通则认为在线

25、写一个脚本,判断一个指定的脚本是否是语法错误;如果有错误,则提醒用户键入Q或者q无视错误并退出其它任何键可以通过vim打开这个指定的脚本;

26、写一个脚本:
1、创建一个函数,能接受两个参数:
1)第一个参数为URL,即可下载的文件;第二个参数为目录,即下载后保存的位置;
2)如果用户给的目录不存在,则提示用户是否创建;如果创建就继续执行,否则,函数返回一个51的错误值给调用脚本;
3)如果给的目录存在,则下载文件;下载命令执行结束后测试文件下载成功与否;如果成功,则返回0给调用脚本,否则,返回52给调用脚本;

27、写一个脚本:
1、创建一个函数,可以接受一个磁盘设备路径(如/dev/sdb)作为参数;在真正开始后面步骤之前提醒用户有危险,并让用户选择是否继续;
   而后将此磁盘设备上的所有分区清空(提示,使用命令dd if=/dev/zero of=/dev/sdb bs=512 count=1实现,注意其中的设备路径不要写错了
   ;如果此步骤失败,返回67给主程序;
   接着在此磁盘设备上创建两个主分区,一个大小为100M,一个大小为1G;如果此步骤失败,返回68给主程序;
   格式化此两分区,文件系统类型为ext3;如果此步骤失败,返回69给主程序;
   如果上述过程都正常,返回0给主程序;
2、调用此函数;并通过接收函数执行的返回值来判断其执行情况,并将信息显示出来;

[root@localhost tmp]# cat test
#!/bin/bash
#chkconfig: 345 85 15
#description: test

restart() {
        /etc/init.d/httpd restart
}

case "$1" in
        restart)
                restart
                ;;
        *)
                echo $"Usage: $0 {restart}"
esac

[root@localhost tmp]# chmod u+x test
[root@localhost tmp]# cp -a test /etc/init.d/
[root@localhost tmp]# chkconfig --add test
[root@localhost tmp]# chkconfig --list | grep test
test            0:off   1:off   2:off   3:on    4:on    5:on    6:off
[root@localhost tmp]# service test restart
Stopping httpd:                                            [  OK  ]
Starting httpd:                                            [  OK  ]

23、写一个脚本,实现批量添加20个用户,用户名为user1-20,密码为user后面跟5个随机字符
[root@localhost tmp]# cat Useradd.sh
#!/bin/bash
#description: useradd

for i in `seq 1 20`
do
        pwd=$(cat /dev/urandom | head -1 | md5sum | head -c 5)
        useradd user$i
        echo "user$i$pwd" | passwd --stdin user$i
        echo user$i user$i$pwd" >> userinfo.txt
done

24、写一个脚本,实现判断192.168.1.0/24网络里,当前在线的IP有哪些,能ping通则认为在线
#!/bin/bash

for ip in `seq 1 25`
do
        {
        ping -c 1 192.168.1.$ip > /dev/null 2>&1
        if [ $? -eq 0 ]; then
                echo 192.168.1.$ip UP
        else
                echo 192.168.1.$ip DOWN
        fi
        }&

done
wait

25、写一个脚本,判断一个指定的脚本是否是语法错误;如果有错误,则提醒用户键入Q或者q无视错误并退出其它任何键可以通过vim打开这个指定的脚本;
[root@localhost tmp]# cat checksh.sh
#!/bin/bash

read -p "please input check script-> " file
if [  -f $file ]; then
        sh -n $file > /dev/null 2>&1
        if [ $? -ne 0 ]; then
                read -p "You input $file syntax error,[Type q to exit or Type vim to edit]" answer
                case $answer in
                        q | Q)
                                exit 0
                                ;;
                        vim)
                                vim $file
                                ;;
                         *)

exit 0

;;
                esac

fi
else
        echo "$file not exist"
        exit 1
fi

26、写一个脚本:
1、创建一个函数,能接受两个参数:
1)第一个参数为URL,即可下载的文件;第二个参数为目录,即下载后保存的位置;
2)如果用户给的目录不存在,则提示用户是否创建;如果创建就继续执行,否则,函数返回一个51的错误值给调用脚本;
3)如果给的目录存在,则下载文件;下载命令执行结束后测试文件下载成功与否;如果成功,则返回0给调用脚本,否则,返回52给调用脚本;

[root@localhost tmp]# cat downfile.sh
#!/bin/bash

url=$1
dir=$2
download()
{
        cd $dir >> /dev/null 2>&1
        if [ $? -ne 0 ];then
                read -p "$dir No such file or directory,create?(y/n)" answer
                if [ "$answer" == "y" ];then
                        mkdir -p $dir
                        cd $dir
                        wget  $url 1> /dev/null 2>&1
                        if [ $? -ne 0 ]; then
                                return "52"
                        fi
                else
                        return "51"

fi
        fi
}

download $url $dir
echo $?

maintenance ShellScripts的更多相关文章

  1. 第24/24周 数据库维护(Database Maintenance)

    哇哦,光阴似箭!欢迎回到性能调优培训的最后一期.今天我会详细讲下SQL Server里的数据库维护,尤其是索引维护操作,还有如何进行数据库维护. 索引维护 作为一个DBA,数据库维护是你工作中非常重要 ...

  2. 玩转PowerShell第三节——【SCOM Maintenance Mode】-技术&分享

    概述 Microsoft System Center Operations Manager 2007 sp1(SCOM)是微软推出的专业系统监控软件,可以监控部署在网络中的服务器.应用系统和客户端,提 ...

  3. cloud maintenance of OpenNebula

    OpenNebula 4.4.1 maintenance release,官方建议当前的生产环境使用3.x or 4.x的其它版本; php调用curl工具伪造ip Upgrading from Op ...

  4. gdb在运行maintenance info program-spaces命令时coredump

    coredump时的信息: (gdb) maintenance info program-spaces *** Error in `gdb': free(): invalid pointer: 0x0 ...

  5. Setup SQL Server 2008 Maintenance Plan Email Notifications

    一条龙作完,如何设置EXCHANGE的操作员邮件通知.. ~~~~ http://808techblog.com/2009/07/setup-sql-server-2008-maintena.html ...

  6. The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.

    The server is temporarily unable to service your request due to maintenance downtime or capacity pro ...

  7. 产品 线上 保持 和 支持 服务 (Support and maintenance solutions)

    Maintenance and support are the key factors for the smooth functioning of ERP solutions. ERP mainten ...

  8. 一个"Median Maintenance"问题

    题目要求: Download the text file here. The goal of this problem is to implement the "Median Mainten ...

  9. Maste Note for OCR / Vote disk Maintenance Operations (ADD/REMOVE/REPLACE/MOVE)

    Doc ID 428681.1 Applies to: Oracle Database - Enterprise Edition - Version 10.2.0.1 to 11.2.0.1.0 [R ...

随机推荐

  1. UIImage图片转NSData

    在Iphone上有两种读取图片数据的简单方法: UIImageJPEGRepresentation  取UIImage的JPEG格式的NSData UIImagePNGRepresentation.  ...

  2. 【转】vs2010下创建webservice

    题记:学了六个月java一直想做java,没想到进了.NET项目组,还是VB2012,还有WebService,压力山大,这篇纯粹看看多图的效果,版主不要怪罪. Visual Studio 2010默 ...

  3. C# 通过Attribute制作的一个消息拦截器

    首先,我们先要制作一个自己定义Attribute,让他能够具有上下文读取功能,所以我们这个Attribute类要同一时候继承Attribute和IContextAttribute. 接口IContex ...

  4. python语言

    python语言 因为我比较熟悉python语言,所以月刊中python语言的项目居多,个人能力有限,其他语言涉及甚少,欢迎各路人士加入,丰富月刊的内容. 当然,如果您有更好的建议或者意见,欢迎发邮件 ...

  5. 解决:“Ubuntu 10.04 LTS _Lucid Lynx_ - Release i38...

    编译android源码,找不到g++.通过apt-get下载时候,总是提示“Ubuntu 10.04 LTS _Lucid Lynx_ - Release i386 (20100429)” 的盘片插入 ...

  6. yum 安装 5.6

    http://www.cnblogs.com/XBlack/p/5178758.html

  7. Logstash 默认不处理一天前的文件

    The default behavior of the file input plugin is to ignore files whose last modification is greater ...

  8. php 验证身份证有效性,根据国家标准GB 11643-1999 15位和18位通用

    //验证身份证是否有效 function validateIDCard($IDCard) { if (strlen($IDCard) == 18) { return check18IDCard($ID ...

  9. matlab 矩阵

    假设矩阵A=[1 3;4 2] 1.对角置零: A-diag(diag(A)) 2.求A的特征值以及特征向量: 用到eig(A)函数,此函数有五种用法,如下: 2.1 E=eig(A):求矩阵A的全部 ...

  10. POJ3253 Fence Repair(贪心)

    分割木板的顺序是自由的,所以每次选择两块最短的板,组合在一起,增加队列,原来两个板出队,直到队列中为空或者仅仅剩下一个板时结束.这里使用优先队列较为方便. #include<iostream&g ...