Please help me with my cron job. Immense details inside.

Installing, Configuring, Troubleshooting server daemons such as Web and Mail
pschaff
Retired Moderator
Posts: 18276
Joined: 2006/12/13 20:15:34
Location: Tidewater, Virginia, North America
Contact:

Re: Please help me with my cron job. Immense details inside.

Post by pschaff » 2010/01/26 21:04:19

What does "crontab -l" show?

Kinsbane
Posts: 11
Joined: 2010/01/23 02:14:07

Re: Please help me with my cron job. Immense details inside.

Post by Kinsbane » 2010/01/26 21:09:35

And, for posterity's sake, here's what my crontab looks like for user jshaw:
[code]
MAILTO=jshaw@michaelrobertvictor.com
07 13 * * * /home/jshaw/retirement_time
[/code]

The file "retirement_time" contains ONLY this:
[code]
/usr/bin/php -f /home/jshaw/retireevents.php
[/code]

Kinsbane
Posts: 11
Joined: 2010/01/23 02:14:07

Re: Please help me with my cron job. Immense details inside.

Post by Kinsbane » 2010/01/26 21:15:38

[quote]
michaelnel wrote:
Could you please just use the command line and utilities like "ls" instead of pasting all that gui junk into the messages? At least for me, the gui stuff makes it more difficult to read the information.... to the point where I don't want to read it.[/quote]

[code]
[jshaw@thunder ~]$ ls -l /home/jshaw
total 588472
drwxrwxr-x 53 root root 4096 Aug 4 15:08 admin_mrv
-rw-r--r-- 1 jshaw jshaw 0 Jan 22 17:33 cron.log?
-rw-r--r-- 1 jshaw jshaw 63 Jan 26 13:04 crontab.txt
drwxrwxr-x 10 jshaw apache 4096 Feb 12 2009 dc20
-rw-r--r-- 1 root root 19892378 Dec 18 16:52 design_center20090429.sql
-rw-r--r-- 1 root root 22049283 Dec 18 16:52 design_center20090528.sql
drwxr-xr-x 2 jshaw jshaw 4096 Feb 11 2009 Desktop
-rw-r--r-- 1 jshaw jshaw 559351112 Aug 7 17:31 dtheory-retro-12x18.psd
-rw-r--r-- 1 jshaw jshaw 3495 Aug 17 15:07 fdbckmail.php
-rw-r--r-- 1 jshaw jshaw 1536 Aug 17 15:06 opregmail.php
-rw-r--r-- 1 jshaw jshaw 332194 Aug 4 14:32 php_browscap.ini
-rwxr-xr-x 1 root root 303308 Mar 12 2009 php_browscap.ini.bak
-rwxrwxrwx 1 jshaw jshaw 1126 Jan 22 17:48 retireevents.php
-rwxr-xr-x 1 jshaw jshaw 44 Jan 25 11:40 retirement_time
drwxr-xr-x 2 jshaw jshaw 4096 Jul 21 2009 test
[jshaw@thunder ~]$
[/code]

pschaff
Retired Moderator
Posts: 18276
Joined: 2006/12/13 20:15:34
Location: Tidewater, Virginia, North America
Contact:

Re: Please help me with my cron job. Immense details inside.

Post by pschaff » 2010/01/26 21:16:05

[quote]
Kinsbane wrote:
...
MAILTO=jshaw@michaelrobertvictor.com
...[/quote]

That's the line you should have obfuscated. :-)

Perhaps it should be[code]
#!/bin/bash
/usr/bin/php -f /home/jshaw/retireevents.php
[/code]

Kinsbane
Posts: 11
Joined: 2010/01/23 02:14:07

Re: Please help me with my cron job. Immense details inside.

Post by Kinsbane » 2010/01/26 22:29:07

[quote]
pschaff wrote:
[quote]
Kinsbane wrote:
...
MAILTO=jshaw@michaelrobertvictor.com
...[/quote]

That's the line you should have obfuscated. :-)

Perhaps it should be[code]
#!/bin/bash
/usr/bin/php -f /home/jshaw/retireevents.php
[/code][/quote]

Hehe, I don't work for michaelrobertvictor.com

Oh well.

The cron will run in 3 minutes so we'll see what happens!

Kinsbane
Posts: 11
Joined: 2010/01/23 02:14:07

Re: Please help me with my cron job. Immense details inside.

Post by Kinsbane » 2010/01/26 22:43:47

:(

Still this error:
[quote]
/bin/sh: /home/jshaw/retirement_time
: No such file or directory
[/quote]

/home/jshaw/retirement_time contains this:
[code]
#!/bin/bash
/usr/bin/php -f /home/jshaw/retireevents.php
[/code]

Oh well. It was a nice feature to think about, looks like we don't get to use it though and I can still be everyone else's clean up guy.

Thanks again for everyone's help. I really do appreciate it.

pschaff
Retired Moderator
Posts: 18276
Joined: 2006/12/13 20:15:34
Location: Tidewater, Virginia, North America
Contact:

Re: Please help me with my cron job. Immense details inside.

Post by pschaff » 2010/01/26 23:45:08

We're missing something (probably obvious when one sees it). This really [b]ought[/b] to work. I use cron jobs all the time, so this [i]should[/i] be easy. :-x :evil: :-?

Kinsbane
Posts: 11
Joined: 2010/01/23 02:14:07

Re: Please help me with my cron job. Immense details inside.

Post by Kinsbane » 2010/01/27 01:06:21

[quote]
pschaff wrote:
We're missing something (probably obvious when one sees it). This really [b]ought[/b] to work. I use cron jobs all the time, so this [i]should[/i] be easy. :-x :evil: :-?[/quote]

I also just found out I can't install gnome-schedule. I wanted to try and setup these tasks to run automatically through a GUI scheduler which works with crontab.

Do you know of any others available for CentOS?

pschaff
Retired Moderator
Posts: 18276
Joined: 2006/12/13 20:15:34
Location: Tidewater, Virginia, North America
Contact:

Re: Please help me with my cron job. Immense details inside.

Post by pschaff » 2010/01/27 13:54:14

Sorry - the closest I have come to a GUI scheduler is[code]
export EDITOR=emacs
crontab -e
[/code]
:-)

Kinsbane
Posts: 11
Joined: 2010/01/23 02:14:07

Re: Please help me with my cron job. Immense details inside.

Post by Kinsbane » 2010/01/27 19:59:22

Well, I found the solution, although it IS a bit weird!

I was reading this article:
http://net.tutsplus.com/tutorials/other/scheduling-tasks-with-cron-jobs/

And I noticed the part about the bracket ( > ) to write to a log file. I changed the PHP file to not have the hash-bang declaration in the beginning, and put the parser path in the cronjob line instead. So now, my cron job looks like this:
[code]
40 11 * * * /usr/bin/php /home/jshaw/retireevents.php >> /home/jshaw/cron.log
[/code]

And I just got an email from the PHP script, meaning it ran like it should!

I guess the cronjobber was looking for a bracket or two to signify the end of the file/path declaration.

Post Reply