How to setup cronjob on amazon server through php script -
normally using filezilla use set cronjob
e.g
03 * * * * php /var/www/html/projectname/index.php controllername/functionname
but want php have tried. /var/spool/cron/
path have file named abc.
public function cron_test() { $output = shell_exec('crontab -l'); $output = $output .php_eol. "03 * * * * php /var/www/html/projectname/index.php controllername/functionname".php_eol.; $myfile = fopen("/var/spool/cron/abc", "a"); fwrite($myfile, $output); fclose($myfile); echo exec('/var/spool/cron/abc'); }
what function write cronjob next of previous 1 without new line
note: have try /n or /n/r instead of php_eol won't work there no extention of file
Comments
Post a Comment