Im having a small problem i searched a while about it but didnt found any good aswer for my problem , so here it is:
I have a PHP script with user database and i want users to have a small button that will make a certain task execute for a certain time ( imagine 2 hours ) , and this task will keep running till the job is done. The user can stop the task and hit continue , and the task will stop executing after 2 hours!
Any ideia how i can do it?
My actual hosting have crontab.
Well you haven’t explained your problem in enough details , but you should this generally :
when users post tasks , write these tasks in a database table, with other information such as start time and end time (and you can update these due to user new input), then write a script which reads these tasks from database and compares current time to start time and if it is time to run, runs the task.
now put this single script in a cron job
This is actually a better idea than creating a cron job for each user defined task