测试用的一个脚本,已经成功启动了。但是还需要继续进行优化。
#!/bin/sh##################monit altas#author:zwy#2016-12-15#################while truedodeclare -i cnt=`ps -ef|grep mysql-proxy|grep -v grep|wc -l`if [ $cnt -eq 0 ]then ech
#!/bin/bash#author:zwy#2016-12-15#auto backup db ypshdt=`date "+%Y_%m_%d"`prefix="ypsh_"suffix='.sql'xname=${prefix}${dt}${suffix}echo $xnamemysql_dir="/usr/local/mysql/bin/"db_bak_dir="/root/ypsh_db_
#!/bin/bashtoday=`date +"%Y-%m-%d"`#echo $todayhname=`hostname`#echo $hnameip=`ifconfig em1 | grep "inet addr" | cut -f 2 -d ":" | cut -f 1 -d " "|cut -f 4 -d "."`echo $ipfname="${hname}_${ip}_${today
#!/bin/bashhname=`hostname`today=`date "+%Y-%m-%d %H:%M:%S"`IP=`ifconfig em1 | grep "inet addr" | cut -f 2 -d ":" | cut -f 1 -d " "`cpu_idle=`top -b -n 1 | grep Cpu | awk '{print $5}' | cut -f 1
最近写个shell,监控系统的运行。其中有一条指令如下: IP=`ifconfig em1 | grep "inet addr" | cut -f 2 -d ":" | cut -f 1 -d " "` 此命令手动执行都ok。可以正常显示ip。我放到计划任务里面每次都执行不成功。最后查明是crontab的环境变量和root用
今天写了一个shell脚本,然后在执行的时候报错,脚本内容很简单,仅供测试:Shell代码 #!/bin/sh echo "test shell " 具体报错信息如下:Shell代码 [root@localhost test]# ./te
linux自动启动脚本
Copyright © 2005-2024 51CTO.COM 版权所有 京ICP证060544号