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. shopncv4 短信接口 提供商 中国短信网

    前提是在后台开启手机注册功能:具体是在设置->账号同步->手机短信 里开启.   修改 siteroot\core\framework\libraries\sms.php   修改 sit ...

  2. VB6.0 String 用法总结

    问题一 VB 去掉字符串的头尾的空格 使用trim() 如: trim(" hello world ")= "hello world" 问题二 判断一个字符串是 ...

  3. 自定义清除重复uses-permission申明的AS插件

    分享一个我刚到天下布医工作时,写的一个android studio插件. 做安卓项目时,经常继承一些第三方sdk,这些sdk都会申请权限,导致AndroidManifest.xml中的uses-per ...

  4. delete 指针

    #include<iostream>using namespace std;class human{public: human(){cout<<"构造";} ...

  5. Promise原理 && 简单实现

    Promise原理 参考https://github.com/chunpu/promise/blob/master/promise.js 个人认为原博的实现有点问题 在next函数的实现上, 会导致无 ...

  6. VBS解析时候遇到时间

    http://msdn.microsoft.com/en-us/library/aa393687(v=vs.85).aspx MSDN说的很详细么. http://msdn.microsoft.com ...

  7. Linux 下防火墙端口设置

    方式1:     /sbin/iptables -I INPUT -p tcp --dport 8011 -j ACCEPT  #开启8011端口      /etc/rc.d/init.d/ipta ...

  8. C语言对象化编程

    以下为一个引子: C中struct的函数实现,只能用函数指针成员. C结构体内不能有函数的代码,但可以有函数的指针. C/C code Code highlighting produced by Ac ...

  9. 重写equal要重写 hashCode的原因

    public class Test { public static void main(String[] args) { Person person1 = new Person(); person1. ...

  10. SQL SERVER2012 无法连接远程服务器

    SQL SERVER2012 无法连接远程服务器,报"尝试读取受保护的内存"错误. 解决方法: 运行CMD,输入 netsh winsock reset,回车.重启SSMS,搞定.