I want to make many tasks(different shell script) run with crontab by clicking on a button on website to start all tasks specified in crontab. Is it possible to do this? Please provide me the recommendation.
1 Answer
As you are looking for an 'on demand' click of the button script execution, you do not need to use crontab.
You can simply use something like PHP's shell_exec() or exec() to achieve your goal.
If you wish to execute previously set up crons on demand, something like run-parts /etc/cron.daily can be passed to the above functions.
-
2This is exactly what I was looking for, the exec() function worked perfectly, thank you!Sensoray– Sensoray2020-08-03 17:57:16 +00:00Commented Aug 3, 2020 at 17:57
crontabwhich is a technique for running scripts triggered by time only.crontabrun a script that checks if the button was clickedphpexecute something server-side, or have it "drop" a flag file which would then be detected by a local script (more flexibility and security, avoidingexec).