Bash script that executes php file every 5 seconds

后端 未结 6 1956
孤街浪徒
孤街浪徒 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 07:02

    to make the cron job work (executable) do a

    $ chmod +x /home/user/public_html/website.com/test.sh
    

    to make the bash script call the php

    $ chmod +x /home/user/public_html/website.com/test.php
    

    finally your php file should have a shebang copy paste this code to top of php file

    #!/usr/bin/php
    

    or without shebang you need to change you shell script call

    php /home/user/public_html/website.com/test.php
    

提交回复
热议问题