I want lớn edit cron tab daily lớn delete / add some jobs .. sánh I added cron job ( helper job ) lớn run rẩy php script lớn handle these edits.
When I run rẩy this script by browser works fine .. but when it runs using the helper job not running and I receive notification mail from cpanel with this error :
Please note I am on shared hosting plan with C-Panel sánh I have no root access .. but the code working fine when run rẩy from browser.
Error:
You (dcfn35c8st1b) are not allowed lớn use this program (crontab)
See crontab(1) for more information
You (dcfn35c8st1b) are not allowed lớn use this program (crontab)
See crontab(1) for more information
You (dcfn35c8st1b) are not allowed lớn use this program (crontab)
See crontab(1) for more information
You (dcfn35c8st1b) are not allowed lớn use this program (crontab)
See crontab(1) for more information
You (dcfn35c8st1b) are not allowed lớn use this program (crontab)
See crontab(1) for more information
PHP Script:
exec('crontab -l', $crontab);
$record_found = false;
foreach($crontab as $key => $value){
if(strpos($value, 'record_extra.php') !== false){
//echo $key . ' ' . $value . '
';
unset($crontab[$key]);
$record_found = true;
}
if(strpos($value, 'record.php') !== false){
//echo $key . ' ' . $value . '
';
unset($crontab[$key]);
}
}
if($record_found){
file_put_contents('/tmp/crontab.txt', arrayToString($crontab) . $firstJob.PHP_EOL);
if(exec('crontab /tmp/crontab.txt')){
//echo 'success
';
} else {
//echo 'error
';
}
$output = shell_exec('crontab -l');
file_put_contents('/tmp/crontab.txt', $output . $secondJob.PHP_EOL);
if(exec('crontab /tmp/crontab.txt')){
//echo 'success
';
} else {
//echo 'error
';
}
} else {
$output = shell_exec('crontab -l');
file_put_contents('/tmp/crontab.txt', $output . $firstJob.PHP_EOL);
if(exec('crontab /tmp/crontab.txt')){
//echo 'success
';
} else {
//echo 'error
';
}
$output = shell_exec('crontab -l');
file_put_contents('/tmp/crontab.txt', $output . $secondJob.PHP_EOL);
if(exec('crontab /tmp/crontab.txt')){
//echo 'success
';
} else {
//echo 'error
';
}
}
Need your help. Thanks in advance.