This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#监视Apache服务器 | |
#查看Apache是否启动,如果没有,则启动。这里不是简简单单的使用进程查询和端口查询 | |
#而是使用nmap命令来扫描tcp端口,并找到Apache | |
port=$(nmap -sT 127.0.0.1|grep tcp|grep http|awk '{print $2}') | |
#注意判断条件中,变量$port的引号是必须的 | |
if [ "$port" == "open" ];then | |
echo -e "Apache is Running!" | |
else | |
sudo service httpd start $>/dev/null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
#v_process填入监视的程序命令 | |
v_process='framework -p UserStateChange -m UserStateChange1' | |
#打印表头 | |
printf "%-10s %-15s %-6s %-10s\n" PID TIME CPU MEMORY | |
#每个10秒循环打印进程的进程ID,时间,CPU值和内存值 | |
while [ 1 ] | |
do | |
echo $v_process|while read v_1 v_2 v_3 v_4 v_5 | |
do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ALT_DB_USER=occ_bf | |
ALT_DB_PASSWD=occ_bf | |
ALT_DB_SERVER=10.161.7.56 | |
ALT_DB_PORT=20300 | |
ORA_DB_USER=occdev | |
ORA_DB_PASSWD=occdev | |
ORA_DB_SERVER=occdb | |
DATA_PATH=/occlog/TianY |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
cd /home/fatmouse/sh | |
ls>./test.log | |
for i in $(cat ./test.log) | |
do | |
echo $i | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#硬盘使用率报警 | |
Rate=`df -h|grep /dev/sda5|awk '{print $5}'|cut -f 1 -d "%"` | |
#变量如果使用整数判断,不需要双引号 | |
if [ $Rate -ge 90 ];then | |
echo -e "The filesystem is almost full!\n" | |
else | |
echo -e "The system is enough!\n" | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#备份数据库 | |
datetime=$(date +%y%m%d) | |
size=$(du -sh /home/fatmouse/sh) | |
if [ -d /home/fatmouse/backup ];then | |
echo "Date: $datetime">/home/fatmouse/sh/info.txt | |
echo "Size: $size" >>/home/fatmouse/sh/info.txt | |
cd /home/fatmouse/backup | |
tar -zcf Backup_$datetime.tar.gz /home/fatmouse/sh /home/fatmouse/info.txt &> /dev/null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#批量添加用户 | |
read -p "Please input user name: " -t 30 name | |
read -p "Please input the number of users: " -t 30 num | |
read -p "Please input the password of users: "-t 30 pass | |
if [ ! -z "$name" -a ! -z "$num" -a ! -z "$pass" ];then | |
#将num变量传给sed,sed进行判断是否为数字,如果为数字 | |
#将数字替换成空,如果有一个字符都不为数字,那么整个y就不会为空 | |
y=$(echo $num|sed 's/[0-9]//g') | |
#如果num全部为数字,那么条件才能为真,其实进行for循环 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
source $HOME/.profile | |
#declare a number array | |
declare -a serialNumber=0 | |
declare -i i=0 | |
#Alibase Database Connection String | |
AltibaseConn='isql -s 10.161.7.56 -u occ_bf -p occ_bf -port 20300 -NLS_USE US7ASCII' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
. $HOME/.profile | |
echo "start `basename $0`" | |
#echo $* | |
declare -a number=0 | |
declare -i i=0 | |
#read number | |
cat number.txt |while read num | |
do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT to_char(last_day(add_months(sysdate,-1))+1,'yyyymmdd')||'000000' '生效日期',TO_CHAR(last_day(add_months(sysdate,1)),'yyyymmdd')||235959 '失效日期' FROM DUAL; |
OlderNewer