FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > CentOS > CentOS

 
 
LinkBack Thread Tools
 
Old 07-31-2011, 03:07 AM
Tim Dunphy
 
Default cron jobs not running

hello list!!

I'm attempting to find out why this cron job isn't running. the host is centos 5.6 on i386 just so you know.


0 3 * * * /bin/alldb > /home/bluethundr/backupdb/alldb-$(date +%Y%m%d%H%S).sql

The job is meant to backup all the databases on a mysql server every day at 3 am. I have checked the backup directory and nothing is showing up for those days.

I created the same job to run every minute but just like the job above the backups do not appear.


* * * * * /bin/alldb > /home/bluethundr/backupdb/alldb-$(date +%Y%m%d%H%S).sql


I have verified that the cron service is, indeed, running

[root@VIRTCENT09:/home/bluethundr/backupdb] #service crond status
crond (pid 8053) is running...


However I do see the job is running in the cron logs


[root@VIRTCENT09:/home/bluethundr/backupdb] #tail /var/log/cron
Jul 30 22:59:01 VIRTCENT09 crond[8007]: (root) CMD (/bin/alldb > /home/bluethundr/backupdb/alldb-$(date +)
Jul 30 22:59:46 VIRTCENT09 crond[8053]: (CRON) STARTUP (V5.0)
Jul 30 23:00:01 VIRTCENT09 crond[8074]: (root) CMD (/bin/alldb > /home/bluethundr/backupdb/alldb-$(date +)
Jul 30 23:00:10 VIRTCENT09 crontab[8121]: (root) BEGIN EDIT (root)
Jul 30 23:01:01 VIRTCENT09 crond[8134]: (root) CMD (run-parts /etc/cron.hourly)
Jul 30 23:01:01 VIRTCENT09 crond[8135]: (root) CMD (/bin/alldb > /home/bluethundr/backupdb/alldb-$(date +)
Jul 30 23:02:01 VIRTCENT09 crond[8157]: (root) CMD (/bin/alldb > /home/bluethundr/backupdb/alldb-$(date +)
Jul 30 23:03:02 VIRTCENT09 crond[8265]: (root) CMD (/bin/alldb > /home/bluethundr/backupdb/alldb-$(date +)
Jul 30 23:03:13 VIRTCENT09 crontab[8121]: (root) END EDIT (root)
Jul 30 23:04:01 VIRTCENT09 crond[8288]: (root) CMD (/bin/alldb > /home/bluethundr/backupdb/alldb-$(date +)



Still nothing is appearing in the backup directory.

But if i run the command by hand it does work.

[root@VIRTCENT09:/home/bluethundr/backupdb] #/bin/alldb > /home/bluethundr/backupdb/alldb-$(date +%Y%m%d%H%S).sql

And the file is created:

_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 07-31-2011, 03:19 AM
Cliff Pratt
 
Default cron jobs not running

On Sun, Jul 31, 2011 at 3:07 PM, Tim Dunphy <bluethundr@jokefire.com> wrote:
> hello list!!
>
> I'm attempting to find out why this cron job isn't running. the host is centos 5.6 on i386 just so you know.
>
>
> 0 * * * 3 * * * * * * * * * * * * * * * /bin/alldb *> /home/bluethundr/backupdb/alldb-$(date +%Y%m%d%H%S).sql
>
> The job is meant to backup all the databases on a mysql server every day at 3 am. I have checked the backup directory and nothing is showing up for those days.
>
> I created the same job to run every minute but just like the job above the backups do not appear.
>
>
> * * * * * * * * * * * * * * * * * /bin/alldb *> /home/bluethundr/backupdb/alldb-$(date +%Y%m%d%H%S).sql
>
>
> I have verified that the cron service is, indeed, running
>
> [root@VIRTCENT09:/home/bluethundr/backupdb] #service crond status
> crond (pid *8053) is running...
>
>
> However I do see the job is running in the cron logs
>
>
> [root@VIRTCENT09:/home/bluethundr/backupdb] #tail /var/log/cron
> Jul 30 22:59:01 VIRTCENT09 crond[8007]: (root) CMD (/bin/alldb *> /home/bluethundr/backupdb/alldb-$(date +)
> Jul 30 22:59:46 VIRTCENT09 crond[8053]: (CRON) STARTUP (V5.0)
> Jul 30 23:00:01 VIRTCENT09 crond[8074]: (root) CMD (/bin/alldb *> /home/bluethundr/backupdb/alldb-$(date +)
> Jul 30 23:00:10 VIRTCENT09 crontab[8121]: (root) BEGIN EDIT (root)
> Jul 30 23:01:01 VIRTCENT09 crond[8134]: (root) CMD (run-parts /etc/cron.hourly)
> Jul 30 23:01:01 VIRTCENT09 crond[8135]: (root) CMD (/bin/alldb *> /home/bluethundr/backupdb/alldb-$(date +)
> Jul 30 23:02:01 VIRTCENT09 crond[8157]: (root) CMD (/bin/alldb *> /home/bluethundr/backupdb/alldb-$(date +)
> Jul 30 23:03:02 VIRTCENT09 crond[8265]: (root) CMD (/bin/alldb *> /home/bluethundr/backupdb/alldb-$(date +)
> Jul 30 23:03:13 VIRTCENT09 crontab[8121]: (root) END EDIT (root)
> Jul 30 23:04:01 VIRTCENT09 crond[8288]: (root) CMD (/bin/alldb *> /home/bluethundr/backupdb/alldb-$(date +)
>
> Still nothing is appearing in the backup directory.
>
> But if i run the command by hand it does work.
>
> [root@VIRTCENT09:/home/bluethundr/backupdb] #/bin/alldb *> /home/bluethundr/backupdb/alldb-$(date +%Y%m%d%H%S).sql
>
> And the file is created:
>
Tim, the program is run by cron in a different environment to the
standard online environment. Is /bin/alldb a script? If so, *any*
program in the script should have a full path, or the PATH enviroment
variable should be specified in the cron. (see 'man cron').

You could try redirecting all STDERR output to a file (2>filename) to
see if any errors are produced.

Cheers,

Cliff
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 07-31-2011, 03:30 AM
Jorge Fábregas
 
Default cron jobs not running

On 07/30/2011 11:07 PM, Tim Dunphy wrote:
> 0 3 * * * /bin/alldb > /home/bluethundr/backupdb/alldb-$(date +%Y%m%d%H%S).sql

I think the date paremters (percent etc) is causing you problems here.
Try it simple first:

* * * * * /bin/alldb > /home/bluethundr/backupdb/alldb-today.sql

Did it work?

--
Jorge
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 07-31-2011, 03:31 AM
"John R. Dennison"
 
Default cron jobs not running

On Sun, Jul 31, 2011 at 03:19:01PM +1200, Cliff Pratt wrote:
>
> Tim, the program is run by cron in a different environment to the
> standard online environment. Is /bin/alldb a script? If so, *any*
> program in the script should have a full path, or the PATH enviroment
> variable should be specified in the cron. (see 'man cron').

Only execs outside of /bin:/usr/bin need to be fully pathed; cron
exports a default PATH of /bin:/usr/bin.

Please see "man crontab" for the explanation as to what is going wrong
here; look for '%' in the man page.




John
--
Worrying works. About 90% of the things I worry about never happen.

-- Woody Paige (1946-), sports columnist, on ESPN's "Around the Horn"
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 07-31-2011, 07:58 AM
Cliff Pratt
 
Default cron jobs not running

On Sun, Jul 31, 2011 at 3:31 PM, John R. Dennison <jrd@gerdesas.com> wrote:
> On Sun, Jul 31, 2011 at 03:19:01PM +1200, Cliff Pratt wrote:
>>
>> Tim, the program is run by cron in a different environment to the
>> standard online environment. Is /bin/alldb a script? If so, *any*
>> program in the script should have a full path, or the PATH enviroment
>> variable should be specified in the cron. (see 'man cron').
>
> Only execs outside of /bin:/usr/bin need to be fully pathed; cron
> exports a default PATH of /bin:/usr/bin.
>
> Please see "man crontab" for the explanation as to what is going wrong
> here; look for '%' in the man page.
>
Ah! I never knew that! It's a good trap.

Cheers,

Cliff
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 07-31-2011, 09:49 AM
Keith Roberts
 
Default cron jobs not running

On Sun, 31 Jul 2011, Cliff Pratt wrote:

> To: CentOS mailing list <centos@centos.org>
> From: Cliff Pratt <enkiduonthenet@gmail.com>
> Subject: Re: [CentOS] cron jobs not running
>
> On Sun, Jul 31, 2011 at 3:31 PM, John R. Dennison <jrd@gerdesas.com> wrote:
>> On Sun, Jul 31, 2011 at 03:19:01PM +1200, Cliff Pratt wrote:
>>>
>>> Tim, the program is run by cron in a different environment to the
>>> standard online environment. Is /bin/alldb a script? If so, *any*
>>> program in the script should have a full path, or the PATH enviroment
>>> variable should be specified in the cron. (see 'man cron').
>>
>> Only execs outside of /bin:/usr/bin need to be fully pathed; cron
>> exports a default PATH of /bin:/usr/bin.
>>
>> Please see "man crontab" for the explanation as to what is going wrong
>> here; look for '%' in the man page.
>>
> Ah! I never knew that! It's a good trap.

Greetings all!

Cliff - you might like to check out my customizable mysql
database backup script (PHP5 CLI code) at:

http://forums.fedoraforum.org/showpost.php?p=1499959&postcount=3

Use at your own risk of course!

Kind Regards,

Keith Roberts

-----------------------------------------------------------------
Websites:
http://www.karsites.net
http://www.php-debuggers.net
http://www.raised-from-the-dead.org.uk

All email addresses are challenge-response protected with
TMDA [http://tmda.net]
-----------------------------------------------------------------
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 07-31-2011, 09:59 AM
Keith Roberts
 
Default cron jobs not running

On Sun, 31 Jul 2011, Keith Roberts wrote:

Woops! I meant Tim the OP - not Cliff

> Cliff - you might like to check out my customizable mysql
> database backup script (PHP5 CLI code) at:
>
> http://forums.fedoraforum.org/showpost.php?p=1499959&postcount=3

Kind Regards,

Keith Roberts

-----------------------------------------------------------------
Websites:
http://www.karsites.net
http://www.php-debuggers.net
http://www.raised-from-the-dead.org.uk

All email addresses are challenge-response protected with
TMDA [http://tmda.net]
-----------------------------------------------------------------
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 07-31-2011, 11:30 AM
Leonard den Ottolander
 
Default cron jobs not running

Hello Tim,

On Sun, 2011-07-31 at 03:07 +0000, Tim Dunphy wrote:
> * * * * * /bin/alldb > /home/bluethundr/backupdb/alldb-$(date +%Y%m%d%H%S).sql

> Jul 30 22:59:01 VIRTCENT09 crond[8007]: (root) CMD (/bin/alldb > /home/bluethundr/backupdb/alldb-$(date +)

Think you need to quote that date format string, and I suppose the last
field is supposed to be %M not %S.

Also, since "date +" resolves to "" the command as it is currently
interpreted will write to the same file
(/home/bluethundr/backupdb/alldb-) over and over again.

Regards,
Leonard.

--
mount -t life -o ro /dev/dna /genetic/research


_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 07-31-2011, 12:21 PM
Robert Nichols
 
Default cron jobs not running

On 07/30/2011 10:07 PM, Tim Dunphy wrote:
> hello list!!
>
> I'm attempting to find out why this cron job isn't running. the host is centos 5.6 on i386 just so you know.
>
>
> 0 3 * * * /bin/alldb> /home/bluethundr/backupdb/alldb-$(date +%Y%m%d%H%S).sql

> However I do see the job is running in the cron logs
>
>
> [root@VIRTCENT09:/home/bluethundr/backupdb] #tail /var/log/cron
> Jul 30 22:59:01 VIRTCENT09 crond[8007]: (root) CMD (/bin/alldb> /home/bluethundr/backupdb/alldb-$(date +)

From `man 5 crontab`:

The entire command portion of the line, up to a newline or %
character, will be executed by /bin/sh or by the shell specified
in the SHELL vari- able of the cronfile. Percent-signs (%) in
the command, unless escaped with backslash (), will be changed
into newline characters, and all data after the first % will be
sent to the command as standard input.

--
Bob Nichols "NOSPAM" is really part of my email address.
Do NOT delete it.

_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 

Thread Tools




All times are GMT. The time now is 04:24 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2007 - 2008, www.linux-archive.org