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
Below code I've used linux & cent os servers its working for me
Step 1 => Within this path /usr/bin create autocron.sh file -> vim autocron.sh
Step 2 => After creating autocron.sh file -> Put this code within autocron.sh file while true; do begin=date +%s; php executablefile.php; end=date +%s; if [ $(($end - $begin)) -lt 5 ]; then sleep $(($begin + 5 - $end)); fi; done -> Example excutable PHP file name & .sh file shouble be the same .
Step 3 => After that save that autocron.sh file
Step 4 => Give the permissions for autocron.sh file -> chmod +x autocron.sh
Step 5 => And also give the permissions for PHP file -> chmod +x PHP file location (executablefile.php)
Step 5 => This command will runs the .sh file in background process even terminal was closed -> nohup sh autocron.sh&