Linux下Bash脚本重启ColdFusion Apache
Linux下编写简单的Bash Script,其实就类似Windows下的批处理。只要你对自己的目标很明确,基本的Linux命令顺序完成,或者加上一些循环/判断之类,即可完成Bash脚本。
如下为一个很简单的重启ColdFusion+Apache服务的脚本,并做记录,且会自动发送log记录至相应的邮箱(保证系统已安装Postfix或者Sendmail服务,并开启状态)
#!/bin/bash
echo "`date`"
# Stop ColdFusion
/sbin/service coldfusion_8 stop
echo "======================================================================"
sleep 30
#start ColdFusion
/sbin/service coldfusion_8 start
echo "ColdFusion8 restart now"
echo "======================================================================"
sleep 120
echo "`date`"
echo "Please checke the coldfufion PID"
ps -ef|grep coldfusion
# mail CFserver log for reference
/bin/mail -s "ColdFusion Log" [email protected] </opt/coldfusion8/logs/cfserver.log
echo "======================================================================"
echo "ColdFusion log was sent to your email. Finished!"
echo "======================================================================"
echo "Apache2 restart work"
/sbin/service apache2 restart
echo "======================================================================"
echo "`date`"
echo "It is complete now!"
相关推荐
<?php. if (!empty($_POST)) {. $data1 = $_POST["data1"];$data2 = $_POST["data2"];$fuhao = $_POST["fuh