Setting up Cron jobs? How do I do it?

Using applications, configuring, problems
Post Reply
Message
Author
Canadianpride
Posts: 78
Joined: Fri 09 Jun 2006, 21:51

Setting up Cron jobs? How do I do it?

#1 Post by Canadianpride »

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.

PaulBx1
Posts: 2312
Joined: Sat 17 Jun 2006, 03:11
Location: Wyoming, USA

#2 Post by PaulBx1 »


User avatar
Gn2
Posts: 943
Joined: Mon 16 Oct 2006, 05:33
Location: virtual - Veni vidi, nihil est adpulerit

#3 Post by Gn2 »

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

Canadianpride
Posts: 78
Joined: Fri 09 Jun 2006, 21:51

#4 Post by Canadianpride »

Thanks for the link and the advice. For some reason my etc/ folder doesn't have those folders inside of it. Any ideas?
Thanks
Matthew.

JohnMc
Posts: 118
Joined: Fri 07 Apr 2006, 15:18

Setting up Cron jobs? How do I do it?

#5 Post by JohnMc »

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.

Canadianpride
Posts: 78
Joined: Fri 09 Jun 2006, 21:51

#6 Post by Canadianpride »

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.

JohnMc
Posts: 118
Joined: Fri 07 Apr 2006, 15:18

cron

#7 Post by JohnMc »

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.

User avatar
Gn2
Posts: 943
Joined: Mon 16 Oct 2006, 05:33
Location: virtual - Veni vidi, nihil est adpulerit

#8 Post by Gn2 »

To expand upon suggestions:
It may be better to use

Code: Select all

top
> 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 depecated
{man ps} Note that "ps -aux" is distinct from "ps aux".
It may also confuse, showing only the grep for cron (if not part of initiate services) & parent thread

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
Please see (man ps ) for all parameters/differing standards to running process checks.

JohnMc
Posts: 118
Joined: Fri 07 Apr 2006, 15:18

PS depracated?

#9 Post by JohnMc »

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?

User avatar
Gn2
Posts: 943
Joined: Mon 16 Oct 2006, 05:33
Location: virtual - Veni vidi, nihil est adpulerit

#10 Post by Gn2 »

Please refer back to the manpages (or use)

Code: Select all

 info ps
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

Canadianpride
Posts: 78
Joined: Fri 09 Jun 2006, 21:51

#11 Post by Canadianpride »

Thank you all very much for your advice. You've given me some stuff to try out. I've been very busy.... The holdiays and all. But I'll start trying to figure this out as soon as I can.
Thanks again!!!

Matthew.

User avatar
zigbert
Posts: 6621
Joined: Wed 29 Mar 2006, 18:13
Location: Valåmoen, Norway
Contact:

#12 Post by zigbert »

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)

Post Reply