Craig Hopson Posted October 8, 2012 Share Posted October 8, 2012 hi guys im stuck again this is what i have so far but it wont work <?php$data = '0 0 * * * /usr/local/bin/php $HOME/public_html/run_this_script.php';file_put_contents('cron.txt', $data, FILE_APPEND);exec("/usr/bin/crontab cron.txt", $output, $return);if($return === 0) {echo 'Cron Successful';} else {echo 'Cron Unsuccessful';}echo "<br />\nOutput:<br /><br />";var_dump($output);echo "<br /><br />done!";?> Link to comment Share on other sites More sharing options...
justsomeguy Posted October 8, 2012 Share Posted October 8, 2012 What does it do? Link to comment Share on other sites More sharing options...
Craig Hopson Posted October 8, 2012 Author Share Posted October 8, 2012 should create a cron job but just wont work Link to comment Share on other sites More sharing options...
Craig Hopson Posted October 8, 2012 Author Share Posted October 8, 2012 Got it to work now file_put_contents('crontab.txt','0 * * * * php /home/chsitesc/delete1.php'.PHP_EOL);echo exec('crontab crontab.txt');$output = exec('crontab -l');echo $output;$myFile = "crontab.txt";unlink($myFile); Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now