Search code examples
phpsecuritycroncron-task

Is it Safe editing the CronTab with PHP?


I'm building a script thanks to this tuts to append and remove cronjob from the admin part of a website made with php.

Is it safe to implement it on the server ? What could be the issues ?

Thanks


Solution

  • Maybe that:

    List of script in your crontab (f.e.):

    #script1
    #script2
    #script3
    

    I'm removing script from crontab:

    crontab -l | grep -v "#script1" > crontab.txt && crontab crontab.txt
    

    List of script in your crontab after edit:

    #script2
    #script3
    

    Command crontab -l | grep -v "#script1" > crontab.txt && crontab crontab.txt you can run from exec() function.

    I hope I helped.