Setting up Cron jobs? How do I do it?
-
- Posts: 78
- Joined: Fri 09 Jun 2006, 21:51
Setting up Cron jobs? How do I do it?
Hi there. I recently installed xampp and attempted to run a fairly simple online text-based game on it. I need to set up cron jobs to get the 20 minute turns to work. I have absolutely no idea how to go around doing this. I tried to do a google search for cron linux but it all seems to be directed for Denebian linux.
Any help would be appreciated.
Thanks
Matthew.
Any help would be appreciated.
Thanks
Matthew.
See /etc folder - should have four basic schedules :
cron.hourly / .daily / .weekly / .monthly
As well as cron.d (the daemon folder which runs cron jobs)
Put executeable for game in daily or hourly - configure it to whatever game options allowed.
Cron Tasking
cron.hourly / .daily / .weekly / .monthly
As well as cron.d (the daemon folder which runs cron jobs)
Put executeable for game in daily or hourly - configure it to whatever game options allowed.
Cron Tasking
-
- Posts: 78
- Joined: Fri 09 Jun 2006, 21:51
Setting up Cron jobs? How do I do it?
Matthew,
Cron is one of those ancient of the holies from the command line. Practically any How-To or tutorial will steer you right. Cron is practically the same in any *nix distro.
Cron is one of those ancient of the holies from the command line. Practically any How-To or tutorial will steer you right. Cron is practically the same in any *nix distro.
-
- Posts: 78
- Joined: Fri 09 Jun 2006, 21:51
Thanks. I seem to have figured some of this out. I added the files to cron
0 0 * * * /root/lampp/htdocs/fh2/cron/clear_logs.php
0 6 * * * /root/lampp/htdocs/fh2/cron/update_tribute.php
*/2 * * * * /root/lampp/htdocs/fh2/cron/update_turn.php
30 * * * * /root/lampp/htdocs/fh2/cron/update_rankings.php
That's how it looks. It's not working just yet. I look on Google and i appears as if I need to do something to get the .php pages to work.
Thanks
Matthew.
0 0 * * * /root/lampp/htdocs/fh2/cron/clear_logs.php
0 6 * * * /root/lampp/htdocs/fh2/cron/update_tribute.php
*/2 * * * * /root/lampp/htdocs/fh2/cron/update_turn.php
30 * * * * /root/lampp/htdocs/fh2/cron/update_rankings.php
That's how it looks. It's not working just yet. I look on Google and i appears as if I need to do something to get the .php pages to work.
Thanks
Matthew.
cron
Canadianpride,
You have the idea for the setup. Couple of housekeepting issues.
1) Do you have crond running? Best crontab file in the world won't work if the daemon ain't enabled. Do the following from the rxvt terminal:
ps -aux | grep "cron"
If it's running then you will get a match. If nothing then it is not running. From the command prompt again type crond.
2) the cron layout is kept in a crontab text file. The contents of that file expect a layout just like you surmized in your last post. That file is expected to be in the /etc directory.
3) There is a GUI you can use -- Gcrontab. (in 2.10 its under Control Panel) Same rules apply of course.
Hope this helps.
You have the idea for the setup. Couple of housekeepting issues.
1) Do you have crond running? Best crontab file in the world won't work if the daemon ain't enabled. Do the following from the rxvt terminal:
ps -aux | grep "cron"
If it's running then you will get a match. If nothing then it is not running. From the command prompt again type crond.
2) the cron layout is kept in a crontab text file. The contents of that file expect a layout just like you surmized in your last post. That file is expected to be in the /etc directory.
3) There is a GUI you can use -- Gcrontab. (in 2.10 its under Control Panel) Same rules apply of course.
Hope this helps.
To expand upon suggestions:
It may be better to use > To find all processes > running, backgrounded, zombied & killed.
(ps a) will show all started - as well as old stopped/failed :
Also - AFAIK The (-) hyphen is depecatedPlease see (man ps ) for all parameters/differing standards to running process checks.
It may be better to use
Code: Select all
top
(ps a) will show all started - as well as old stopped/failed :
Also - AFAIK The (-) hyphen is depecated
It may also confuse, showing only the grep for cron (if not part of initiate services) & parent thread{man ps} Note that "ps -aux" is distinct from "ps aux".
Code: Select all
# ps -aux|grep cron
Warning: bad ps syntax, perhaps a bogus '-'? See http://procps.sf.net/faq.html
root 8984 0.0 0.0 1728 664 ? Ss Dec27 0:00 /usr/sbin/cron
root 13425 0.0 0.0 1516 460 pts/1 R+ 01:05 0:00 grep cron
Code: Select all
(top) root 16 0 1728 664 552 S 0.0 0.1 0:00.01 cron
9014 root 17 0 2208 1008 804 S 0.0 0.1 0:00.00 login
9015 root 16 0 1516 616 532 S 0.0 0.1 0:00.00 agetty
PS depracated?
Gn2,
Don't know about the '-' deprecation, ran thru several manpages on Sun, Fedora and Ubuntu. All indicate the '-' as a switch indicator. But you could be right as well. (old habits die hard! I been on Unix since the early 80's. )
What I do find interesting is that if I run a 'man ps' on the version of Puppy (2.10) I am running that it gives what I think is a very bad redention of ps. If I am reading it right it says only 1 switch option is available -c. Which is false as I can run most any of the switch options I generally utilize.
Wierd no?
Don't know about the '-' deprecation, ran thru several manpages on Sun, Fedora and Ubuntu. All indicate the '-' as a switch indicator. But you could be right as well. (old habits die hard! I been on Unix since the early 80's. )
What I do find interesting is that if I run a 'man ps' on the version of Puppy (2.10) I am running that it gives what I think is a very bad redention of ps. If I am reading it right it says only 1 switch option is available -c. Which is false as I can run most any of the switch options I generally utilize.
Wierd no?
Please refer back to the manpages (or use)
Ps has in excess of fifty parameters - it is a very versatile utility.
Be aware Puppy used own BusyBox functions versus full Bash CLI !
Very much like (ls) - the more many of the CLI commands are used - we discover how powerful they are.
I find it helpful to create a test folder, copy or create text files there
and then safely try less understood options.
(Tar & cp ) are such examples that need great care....-if used incorrectly - the O/System can be easily damaged -
ESP if (Puppy) run in full root permissions !
HTH
Code: Select all
info ps
Be aware Puppy used own BusyBox functions versus full Bash CLI !
Very much like (ls) - the more many of the CLI commands are used - we discover how powerful they are.
I find it helpful to create a test folder, copy or create text files there
and then safely try less understood options.
(Tar & cp ) are such examples that need great care....-if used incorrectly - the O/System can be easily damaged -
ESP if (Puppy) run in full root permissions !
HTH
-
- Posts: 78
- Joined: Fri 09 Jun 2006, 21:51
Since Puppy doesn't use runlevels, cron is started at boot from /etc/rc.d/rc.local. Of course you can also start crond manually with typing 'crond' in a terminal.
It is all rather simple:
1. add 'crond' to /etc/rc.d/rc.local
2. edit file /var/spool/cron/crontabs/root with your crontabs. (or use gcrontab for gui)
It is all rather simple:
1. add 'crond' to /etc/rc.d/rc.local
2. edit file /var/spool/cron/crontabs/root with your crontabs. (or use gcrontab for gui)