19spartan94 Posted January 14, 2009 Share Posted January 14, 2009 Hey i was wondering guys, if anyone out there wud hlp me? I need to make a script that makes a row in one of my tables go up by 1 every 5 minutes... help much appreciated thanks, spartan Quote Link to comment Share on other sites More sharing options...
trq Posted January 14, 2009 Share Posted January 14, 2009 You'll need to google Linux cron tutorial. With cron you can schedual the execution of scripts. Quote Link to comment Share on other sites More sharing options...
19spartan94 Posted January 14, 2009 Author Share Posted January 14, 2009 ok thanks, wat iz that thing? Quote Link to comment Share on other sites More sharing options...
trq Posted January 14, 2009 Share Posted January 14, 2009 Google it and find out. Quote Link to comment Share on other sites More sharing options...
19spartan94 Posted January 14, 2009 Author Share Posted January 14, 2009 ok thanks, how do i add this into a PHP/HTML script? Quote Link to comment Share on other sites More sharing options...
trq Posted January 14, 2009 Share Posted January 14, 2009 You don't. Cron executes scripts/commands at a given time. All you need do is write a script to execute your query, then have cron execute this script every five minutes. Quote Link to comment Share on other sites More sharing options...
19spartan94 Posted January 14, 2009 Author Share Posted January 14, 2009 so just write a script and save it as script.sh and then make a con thing like this:? 0,10,20,30,40,50 * * * * /bin/execute/this/script.sh Quote Link to comment Share on other sites More sharing options...
19spartan94 Posted January 14, 2009 Author Share Posted January 14, 2009 ...? Quote Link to comment Share on other sites More sharing options...
trq Posted January 14, 2009 Share Posted January 14, 2009 Something like that. Your syntax is all wrong, but I'm sure if you research it you'll find that out. You shouldn't even need any script as updating mysql is a pretty simple process. The syntax would be something like.... 5 * * * * /usr/bin/mysql -uYOURUSERNAME -pYOURPASS YOURDATABASE -e "UPDATE tbl SET fld = fld + 1;' Quote Link to comment Share on other sites More sharing options...
19spartan94 Posted January 14, 2009 Author Share Posted January 14, 2009 ya ok BUT how do i add it to my script? do i just make a new file and save it as something? if so wat do i save it as? Quote Link to comment Share on other sites More sharing options...
trq Posted January 14, 2009 Share Posted January 14, 2009 You don't add it to any script. You need to add it to your crontab. Most hosts provide some type of web interface to do this, or if you have shell access simply type.... crontab -e Quote Link to comment Share on other sites More sharing options...
19spartan94 Posted January 14, 2009 Author Share Posted January 14, 2009 i cant find shell access OR crontab Quote Link to comment Share on other sites More sharing options...
19spartan94 Posted January 14, 2009 Author Share Posted January 14, 2009 oh yer i just found it do i add a key? Quote Link to comment 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.