DigitalGuard Posted August 5, 2009 Share Posted August 5, 2009 Hello, I have a php script and i want it to run automaticly everyday at a certain time, how can i do this? Thanks DigitalGuard Quote Link to comment https://forums.phpfreaks.com/topic/168982-how-to-have-a-script-run-automaticly-everyday-at-certain-time/ Share on other sites More sharing options...
mikesta707 Posted August 5, 2009 Share Posted August 5, 2009 i believe you can accomplish this with cron jobs. here you go: http://www.google.com/search?q=cron+job+tutorial&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a take your pick from the tutorials listed there Quote Link to comment https://forums.phpfreaks.com/topic/168982-how-to-have-a-script-run-automaticly-everyday-at-certain-time/#findComment-891580 Share on other sites More sharing options...
DigitalGuard Posted August 5, 2009 Author Share Posted August 5, 2009 i believe you can accomplish this with cron jobs. here you go: http://www.google.com/search?q=cron+job+tutorial&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a take your pick from the tutorials listed there Cron job is for UNIX script not to run php, how can i run the php? Quote Link to comment https://forums.phpfreaks.com/topic/168982-how-to-have-a-script-run-automaticly-everyday-at-certain-time/#findComment-891586 Share on other sites More sharing options...
.josh Posted August 5, 2009 Share Posted August 5, 2009 You can setup a cron job to run a php script every x amount of time. Quote Link to comment https://forums.phpfreaks.com/topic/168982-how-to-have-a-script-run-automaticly-everyday-at-certain-time/#findComment-891588 Share on other sites More sharing options...
DigitalGuard Posted August 5, 2009 Author Share Posted August 5, 2009 You can setup a cron job to run a php script every x amount of time. I did try it did not work, then i read somewhere that cron is to run unix script and not PHP file. So what can i do.? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/168982-how-to-have-a-script-run-automaticly-everyday-at-certain-time/#findComment-891599 Share on other sites More sharing options...
mikesta707 Posted August 5, 2009 Share Posted August 5, 2009 taken from: http://www.webmasterworld.com/forum88/6102.htm If you don't have the php cgi installed you can use wget to run a php script via cron. The command is simply: wget -O /dev/null http://www.example.com/somescript.php The -O /dev/null part means send the output to the null device so that no disk space is taken up with the HTML (or whatever) output from your script. hope that helps! Quote Link to comment https://forums.phpfreaks.com/topic/168982-how-to-have-a-script-run-automaticly-everyday-at-certain-time/#findComment-891602 Share on other sites More sharing options...
DigitalGuard Posted August 5, 2009 Author Share Posted August 5, 2009 taken from: http://www.webmasterworld.com/forum88/6102.htm If you don't have the php cgi installed you can use wget to run a php script via cron. The command is simply: wget -O /dev/null http://www.example.com/somescript.php The -O /dev/null part means send the output to the null device so that no disk space is taken up with the HTML (or whatever) output from your script. hope that helps! Thank you let me give it a try. Quote Link to comment https://forums.phpfreaks.com/topic/168982-how-to-have-a-script-run-automaticly-everyday-at-certain-time/#findComment-891608 Share on other sites More sharing options...
bundyxc Posted August 5, 2009 Share Posted August 5, 2009 If by some chance cron jobs don't work, I've been working on a simple cron job alternative that runs your script every day at a certain time. It requires a MySQL database to run, but I could probably tweak it to work without it, and just use a flatfile. Quote Link to comment https://forums.phpfreaks.com/topic/168982-how-to-have-a-script-run-automaticly-everyday-at-certain-time/#findComment-891619 Share on other sites More sharing options...
thebadbad Posted August 5, 2009 Share Posted August 5, 2009 If by some chance cron jobs don't work, I've been working on a simple cron job alternative that runs your script every day at a certain time. It requires a MySQL database to run, but I could probably tweak it to work without it, and just use a flatfile. How does that work, if I may ask? Quote Link to comment https://forums.phpfreaks.com/topic/168982-how-to-have-a-script-run-automaticly-everyday-at-certain-time/#findComment-891624 Share on other sites More sharing options...
DigitalGuard Posted August 5, 2009 Author Share Posted August 5, 2009 If by some chance cron jobs don't work, I've been working on a simple cron job alternative that runs your script every day at a certain time. It requires a MySQL database to run, but I could probably tweak it to work without it, and just use a flatfile. This did not work, can you please help me out with your script... Quote Link to comment https://forums.phpfreaks.com/topic/168982-how-to-have-a-script-run-automaticly-everyday-at-certain-time/#findComment-891636 Share on other sites More sharing options...
dadamssg Posted August 5, 2009 Share Posted August 5, 2009 do you have cpanel? Quote Link to comment https://forums.phpfreaks.com/topic/168982-how-to-have-a-script-run-automaticly-everyday-at-certain-time/#findComment-891643 Share on other sites More sharing options...
DigitalGuard Posted August 5, 2009 Author Share Posted August 5, 2009 do you have cpanel? Yes Quote Link to comment https://forums.phpfreaks.com/topic/168982-how-to-have-a-script-run-automaticly-everyday-at-certain-time/#findComment-891660 Share on other sites More sharing options...
dadamssg Posted August 5, 2009 Share Posted August 5, 2009 look in your cpanel and you'll see the cron job button near the bottom under "Advanced" click on that then click 'standard'. then on the command to run line put something like this php /home/yourusername/public_html/afolder/ascript.php make sure you have a space after 'php' though then set the timer Quote Link to comment https://forums.phpfreaks.com/topic/168982-how-to-have-a-script-run-automaticly-everyday-at-certain-time/#findComment-891666 Share on other sites More sharing options...
DigitalGuard Posted August 5, 2009 Author Share Posted August 5, 2009 look in your cpanel and you'll see the cron job button near the bottom under "Advanced" click on that then click 'standard'. then on the command to run line put something like this php /home/yourusername/public_html/afolder/ascript.php make sure you have a space after 'php' though then set the timer that did not work... Quote Link to comment https://forums.phpfreaks.com/topic/168982-how-to-have-a-script-run-automaticly-everyday-at-certain-time/#findComment-891676 Share on other sites More sharing options...
dadamssg Posted August 5, 2009 Share Posted August 5, 2009 then you probably didn't write the command line right....or you didn't set the timer to like every minute to check. Quote Link to comment https://forums.phpfreaks.com/topic/168982-how-to-have-a-script-run-automaticly-everyday-at-certain-time/#findComment-891682 Share on other sites More sharing options...
DigitalGuard Posted August 5, 2009 Author Share Posted August 5, 2009 Okay this is what i put --------- php /home/username/public_html/portscanner.php?domain=domain.com&rangestart=60&rangestop=100 ----------- I set it to run every min, of every hour, of every day, of every year... Still does not work, Quote Link to comment https://forums.phpfreaks.com/topic/168982-how-to-have-a-script-run-automaticly-everyday-at-certain-time/#findComment-891686 Share on other sites More sharing options...
mikesta707 Posted August 5, 2009 Share Posted August 5, 2009 um... I think instead of username you have to put the actual USERNAME of your ftp account or something like that Quote Link to comment https://forums.phpfreaks.com/topic/168982-how-to-have-a-script-run-automaticly-everyday-at-certain-time/#findComment-891689 Share on other sites More sharing options...
dadamssg Posted August 5, 2009 Share Posted August 5, 2009 i don't think you can have variables on the end of it. Try putting those inside the script...the domain and rangestart and stop. Then is portscanner.php in any folder? or is it right next to your index.php file? Quote Link to comment https://forums.phpfreaks.com/topic/168982-how-to-have-a-script-run-automaticly-everyday-at-certain-time/#findComment-891693 Share on other sites More sharing options...
DigitalGuard Posted August 5, 2009 Author Share Posted August 5, 2009 i don't think you can have variables on the end of it. Try putting those inside the script...the domain and rangestart and stop. Then is portscanner.php in any folder? or is it right next to your index.php file? Finally worked, its running with the following... /ramdisk/bin/php5 /home/username/public_html/portscan.php Quote Link to comment https://forums.phpfreaks.com/topic/168982-how-to-have-a-script-run-automaticly-everyday-at-certain-time/#findComment-891708 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.