首先crontab -e打開進行編輯
添加以下代碼(默認為每秒執行一次腳本crontab.sh):
* * * * * /bin/sh /var/www/aa/crontab.sh
下面是/var/www/aa/crontab.sh腳本代碼
#!/bin/bash
i=0;
step=2 #間隔的秒數,不能大於60
while [ $i -lt 60 ]
do
$(curl 'http://api-test-monitor.shanxinhui.com/user/test2/aa')
sleep $step
i=`expr $i + 2`
done
exit 0
