2015年5月13日 星期三

linux cron 秒 單位執行

1:
vim /etc/cron/default.schedule
*/1 * * * * /usr/sbin/status_network_change.php &


2: status_network_change.php

#!/bin/php -q
<?
for($x=0;$x<60;$x=$x+2){
    exec("/usr/sbin/notify_ip_change.php eth0",$output,$ret);
    exec("/usr/sbin/notify_ip_change.php eth1",$output,$ret);
    exec("sleep 2",$output,$ret);
    file_put_contents('/tmp/test.log', date('Y-m-d H:i:s')."\r\n", FILE_APPEND);
}
?>

沒有留言:

張貼留言