首页 > 系统服务 > 详细

每30秒运行一下shell脚本

时间:2016-09-25 18:46:05      阅读:222      评论:0      收藏:0      [点我收藏+]

cd /usr/local/sbin/     //存放shell脚本 目录。

vim guoguosql.sh      //每30秒运行一个php文件。   文件路径为 vim /home/wwwroot/www/domain/huitiao/web/sql.php

#! /bin/bash
while :; do
        curl http://127.0.0.1:82/sql.php
        sleep 30
done

sh /usr/local/sbin/guoguosql.sh &    //运行 放入后台运行

vim /etc/rc.d/rc.local       //加入开机启动  在最后加入:

sh /usr/local/sbin/guoguosql.sh &  

停止shell

[root@zh-19-46 sbin]# ps aux|grep guoguosql
root 22899 0.0 0.0 106072 1316 pts/0 S 17:36 0:00 sh /usr/local/sbin/guoguosql.sh
root 33419 0.0 0.0 103316 908 pts/0 S+ 17:49 0:00 grep guoguosql

kill 22899

每30秒运行一下shell脚本

原文:http://www.cnblogs.com/carbon3/p/5906437.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!