Bash script that executes php file every 5 seconds

后端 未结 6 1960
孤街浪徒
孤街浪徒 2020-12-22 06:09

Bash script:

$ cat test.sh
#!/bin/bash
while true
do
 /home/user/public_html/website.com/test.php
 sleep 5
done

Im trying to call it with c

6条回答
  •  南笙
    南笙 (楼主)
    2020-12-22 06:46

    The problem is that cron doesn't usually have the same PATH variable as your user do.

    You should use the full path to the sleep binary '/bin/sleep'. But, as other users noted, your script is going to spawn a copy of the script each minute, which may not be what you're expecting.

提交回复
热议问题