This question may seem repetitive, as there are many threads around with the same subject, but thing is that most solutions seems to be linked with terminal coding, which i’m not comfortable with. The problem is simple i have a php script that needs to be executed very 10 seconds. Cron job in cpanel allows only upto 1 minute. What’s the workaround to let cron work every 10 seconds ?
4
Answers
You can use simple bash-script like
#!/bin/sh
while [ true ]
do
php script.php
sleep 10
done
CRON jobs are the standard way to run some tasks periodically. Setting cron jobs require access to the terminal. However, some shared hosting providers don’t provide this and you need to set it up through their interface.
If you hosting don’t provide this you can third-party services that will call you url every ‘X’ seconds.
Here are few of them:
You can Google for more
Note: You can have publically expose the PHP file as an url
You can use the GUI Cpanel, select “once per minute” an try with something like the next command:
Let the cron job run after every minute and in your
php
script the following code example might help you out. I have used counter limit to 6 because this script will run after every ten seconds and six times in one minute.