maintenance ShellScripts
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的更多相关文章
- 第24/24周 数据库维护(Database Maintenance)
哇哦,光阴似箭!欢迎回到性能调优培训的最后一期.今天我会详细讲下SQL Server里的数据库维护,尤其是索引维护操作,还有如何进行数据库维护. 索引维护 作为一个DBA,数据库维护是你工作中非常重要 ...
- 玩转PowerShell第三节——【SCOM Maintenance Mode】-技术&分享
概述 Microsoft System Center Operations Manager 2007 sp1(SCOM)是微软推出的专业系统监控软件,可以监控部署在网络中的服务器.应用系统和客户端,提 ...
- cloud maintenance of OpenNebula
OpenNebula 4.4.1 maintenance release,官方建议当前的生产环境使用3.x or 4.x的其它版本; php调用curl工具伪造ip Upgrading from Op ...
- gdb在运行maintenance info program-spaces命令时coredump
coredump时的信息: (gdb) maintenance info program-spaces *** Error in `gdb': free(): invalid pointer: 0x0 ...
- Setup SQL Server 2008 Maintenance Plan Email Notifications
一条龙作完,如何设置EXCHANGE的操作员邮件通知.. ~~~~ http://808techblog.com/2009/07/setup-sql-server-2008-maintena.html ...
- 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 ...
- 产品 线上 保持 和 支持 服务 (Support and maintenance solutions)
Maintenance and support are the key factors for the smooth functioning of ERP solutions. ERP mainten ...
- 一个"Median Maintenance"问题
题目要求: Download the text file here. The goal of this problem is to implement the "Median Mainten ...
- 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 ...
随机推荐
- c语常用算法库(1)
1,冒泡排序 #include <iostream> using namespace std; int main(){ ]; // 一共n个数, n不超过1000. a用来保存这些数. , ...
- 顺序表--MyArrayList的实现
实现的MyArrayList实为顺序表结构,其中要实现Iterable时必须在内部实现Iterator,即为该表的迭代器. public class MyArrayList<AntType> ...
- 安装ngix
第一步:解压源码包 第二步:./configure -->这个时候会提示缺少PCRE 这个时候要安装yum -y install pcre-devel 第三步:./configure --> ...
- poj3077---进位
#include <stdio.h> #include <stdlib.h> #include<string.h> ]; ]; int main() { int n ...
- ubuntu14.04 qt4开发环境搭建(vnc use gnome)
1,安装qt开发环境软件包:apt-get install qt4-dev-tools qt4-doc qt4-qtconfig qt4-demos qt4-designer qtcreator; 2 ...
- 此证书的签发者无效Missing iOS Distribution signing identity问题解决
问题描述 今天准备打包上传AppStore,结果Xcode报以下错误:Missing iOS Distribution signing identity for XXXXXX 查看证书后发现,Deve ...
- (转)iOS 开发,工程中混合使用 ARC 和非ARC
[前提知识] ARC:Automatic Reference Counting,自动引用计数 在开发 iOS 3 以及之前的版本的项目时我们要自己负责使用引用计数来管理内存,比如要手动 retain. ...
- asp.net ImageMap控件
ImageMap 控件可创建包含定义的作用点区域的图像.当用户单击作用点区域时,该控件可生成到服务器的回发或导航到指定的 URL 首先是添加一个asp:ImageMap 选择asp:CircleHot ...
- 关闭浏览器输入框自动补齐 兼容IE,FF,Chrome等主流浏览器
这篇文章主要介绍了关闭浏览器输入框自动补齐 兼容IE,FF,Chrome等主流浏览器,需要的朋友可以参考下.希望对大家有所帮助 Firefox 和 IE 的浏览器各自实现了input历史记录的功能 ...
- ORA-32001: 已请求写入 SPFILE, 但是在启动时未指定 SPFILE
SQL> alter system set smtp_out_server='smtp.126.com' scope=both;alter system set smtp_out_server= ...