LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 02-24-2006, 05:08 AM   #1
logicalfuzz
Member
 
Registered: Aug 2005
Distribution: Arch Linux
Posts: 291

Rep: Reputation: 39
cron jobs dont execute.. :(


I have been trying this for some thime now. I use RHEL4 with PAM enabled. when i try and set a cron job, the job does not get executed. Smaller jobs like echoing strings, doing an 'ls' work.. but larger ones like backups and opening of pretty heavy apps (including Konsole) dont work. This time i tried setting a cron job for taking the backup of the mysql database. here's the summary..
Quote:
[root@INFOSECTEST infosec]# crontab
30 16 * * * "mysqldump -u root snort > daily/daily_snort_db_backup"
[root@INFOSECTEST infosec]# crontab -l
30 16 * * * "mysqldump -u root snort > daily/daily_snort_db_backup"
[root@INFOSECTEST infosec]# /sbin/service crond status
crond (pid 2809) is running...
[root@INFOSECTEST infosec]# date
Fri Feb 24 16:30:05 IST 2006
[root@INFOSECTEST infosec]# ls daily/
[root@INFOSECTEST infosec]# ls -a daily/
. ..
[root@INFOSECTEST infosec]# tail /var/log/messages
Feb 24 16:20:01 INFOSECTEST crond(pam_unix)[24994]: session closed for user root
Feb 24 16:20:02 INFOSECTEST crond(pam_unix)[24993]: session closed for user root
Feb 24 16:25:01 INFOSECTEST crond(pam_unix)[24998]: session opened for user root by (uid=0)
Feb 24 16:25:01 INFOSECTEST crond(pam_unix)[24998]: session closed for user root
Feb 24 16:30:01 INFOSECTEST crond(pam_unix)[25018]: session opened for user root by (uid=0)
Feb 24 16:30:01 INFOSECTEST crond(pam_unix)[25017]: session opened for user root by (uid=0)
Feb 24 16:30:02 INFOSECTEST crond(pam_unix)[25018]: session closed for user root
Feb 24 16:30:02 INFOSECTEST crond(pam_unix)[25017]: session closed for user root
Feb 24 16:35:01 INFOSECTEST crond(pam_unix)[25025]: session opened for user root by (uid=0)
Feb 24 16:35:02 INFOSECTEST crond(pam_unix)[25025]: session closed for user root
[root@INFOSECTEST infosec]#
Is PAM not allowing it to execute? What can be done?
TIA
 
Old 02-24-2006, 05:43 AM   #2
timmeke
Senior Member
 
Registered: Nov 2005
Location: Belgium
Distribution: Red Hat, Fedora
Posts: 1,515

Rep: Reputation: 61
You shouldn't use a relative path like "daily/...".
cron operates under it's own environment and doesn't know in which directory you are.
It probably starts the job from some other directory (as if it first logged in as root, probably).
Maybe your job doesn't work then because it can't create/find the "daily" directory.

Try specifying an absolute path for the backup or just omitting the output redirection of mysqldump. The latter should cause the output to be mailed to the root user or to someone else if you put MAILTO=some_mail_address
at the top of the crontab file.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
shell script using /etc/cron.hourly to execute cron.php file? rioguia Programming 3 06-11-2008 08:09 AM
Cron Jobs christo512 Linux - Software 1 02-09-2006 09:19 AM
Cron Jobs XaViaR Linux - General 1 06-23-2005 06:57 PM
cron jobs working2hard Linux - Software 0 07-28-2004 05:31 PM
cron jobs Zyanid Linux - Software 0 08-27-2002 05:10 AM


All times are GMT -5. The time now is 03:23 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration