1.自动添加10用戶:#adminuser.sh#!/bin/bash#if[$1==‘--add‘];thenforIin{1..10};doifiduser$I&>/dev/null;thenecho"user$Iexists."elseuseradduser$Iechouser$I|passwd--stdin&>/dev/nullecho"adduser$Ifinished."fidoneelif[$1==‘--del‘];thenforIin{1..10};d..
分类:
系统相关 时间:
2016-10-22 21:35:32
阅读次数:
177
#!/bin/bashcase"$1"instart)virshstart$2;;view)virt-viewer$2&>/dev/null;;poweroff)virshshutdown$2;;stop)virshdestroy$2;;restart)virshreboot$2;;delete)virshundefine$2#删除前端管理不删除存储;;create)virt-install\--name$2\--ram1000\--file/var/lib/libvirt..
分类:
其他好文 时间:
2016-10-20 01:07:29
阅读次数:
140
#!bin/bashcase"$1"instart)echostart$2...virshstart$2&>/dev/null;;poweroff)echopoweroff$2...virshdestroy$2&>/dev/null;;reboot)echoreboot$2...virshdestroy$2&>/dev/nullvirshstart$2&>/dev/null;;view)echoview$2...virt-viewer$2&>..
分类:
其他好文 时间:
2016-10-20 01:01:30
阅读次数:
137
#!/bin/bashcase$1inpoweroff)virshdestroy$2&>/dev/null&;;start)virshstart$2&>/dev/null&virt-viewer$2&>/dev/null;;reboot)virshdestory$2&>/dev/null&virshstart$2&>/dev/null&virt-viewer$2&>/dev/null;;crea..
分类:
其他好文 时间:
2016-10-20 00:56:21
阅读次数:
162
用case语句建立一个shell(功能是打开,关闭,重置,显示虚拟机)#!/bin/bashcase"$1"instart)/*当关键字为start时,执行打开虚拟机$2的语句echostart$2...virshstart$2&>/dev/null;;poweroff)/*当关键字为poweroff时,执行强制关闭虚拟机$2的语句echopoweroff$2...virs..
分类:
系统相关 时间:
2016-10-18 23:47:07
阅读次数:
396
#!/bin/bashcase"$1"instart)virshstarthello/开启虚拟机holle;;poweroff)virshdestroyhello/关闭虚拟机holle;;reboot)virshdestroyhello/关闭虚拟机virshstarthello/开启虚拟机virt-viewerhello/显示虚拟机;;teset)echopoweroffhellovirshdestroyhello&>/dev/null/关闭..
分类:
系统相关 时间:
2016-10-18 23:18:33
阅读次数:
176
第一种startup(){IFS=:whileread-u3IPDIRdossh$IP"sh$DIR/startup_yulong.sh&>/dev/null&"echo"开服执行位置$IP:$DIR"done3<$SCP_FILE
分类:
系统相关 时间:
2016-10-11 01:04:01
阅读次数:
230
九月份偷了下懒,补上一篇注释:shell脚本,需要fio工具,实时监控磁盘的读写性能#!/bin/bash
DATE=$(date+%m-%d)
IOSTATLOG=/var/log/iostat${DATE}.log
FIOLOG=/var/log/fio${DATE}.log
/bin/ps-ef|grep"iostat-dk5"|grep-vgrep>/dev/null
if[$?==0]
then
echo"Diskmoni..
分类:
系统相关 时间:
2016-10-10 02:13:57
阅读次数:
284
crontab定时任务生产应用问题10箴言:1.crond服务必须开启2.定时任务要用绝对路径3.脚本权限问题加/bin/sh4.时间变量问题用反斜线\%转义,最好用脚本5.>/dev/null 2>&1 问题(1>/dev/null 2>/dev/null,,,&>/dev/null)6.定时任务 ...
分类:
其他好文 时间:
2016-10-10 01:29:58
阅读次数:
129
输入一个用户名,判断该用户是admin用户或者普通用户由于管理员用户id是1-500,而普通用户是501以上[root@localhost~]#vim/tmp/uidex.sh
#!/bin/bash
username=$1
if["$username"=""];then
echo"Pleaseinputausername"
exit1
fi
ifid$username&>/dev/null;then
useri..
分类:
其他好文 时间:
2016-10-08 02:58:38
阅读次数:
182