LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-12-2014, 02:15 AM   #1
surekag
LQ Newbie
 
Registered: Feb 2014
Posts: 3

Rep: Reputation: Disabled
Cron job scheduled to the server after logging in via ssh login doest not run


The scripts to take backup of the database is scheduled in the crontab of the server logged in via ssh login in the bash shell.

using the command crontab -e

00 11 * * * /path/to/script

But I find no result in the corresponding folder.

Also tried to execute as root, still the same.

If anyone has better experienced with this, Please guide ..

--
surekag
 
Old 02-12-2014, 02:30 AM   #2
akiuni
Member
 
Registered: Sep 2012
Location: France
Distribution: debian
Posts: 56

Rep: Reputation: Disabled
Hello

Did you have a look at your /var/log/syslog ?
Code:
cat /var/log/syslog |grep -i cron
one common mistake about the crontab is to forget the trailing \n at the end of a line. In that case, you should see that kind of message :
Code:
 (system") ERROR (Missing newline before EOF, this
crontab file will be ignored)
 
1 members found this post helpful.
Old 02-12-2014, 02:38 AM   #3
surekag
LQ Newbie
 
Registered: Feb 2014
Posts: 3

Original Poster
Rep: Reputation: Disabled
hi akiuni, thanks for your reply.

I tried with the command , I can see message as

Code:
Feb 12 07:00:02 h2112419 CRON[6519]: (CRON) info (No MTA installed, discarding output)
And also I didnt schedule anything in /etc/cron.hourly, But in the log file it is displaying as
Code:
Feb 12 07:17:01 h2112419 CRON[6583]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
for every hour.how to remove this.
 
Old 02-12-2014, 02:53 AM   #4
akiuni
Member
 
Registered: Sep 2012
Location: France
Distribution: debian
Posts: 56

Rep: Reputation: Disabled
Quote:
Originally Posted by surekag View Post
Feb 12 07:00:02 h2112419 CRON[6519]: (CRON) info (No MTA installed, discarding output)
This message is not relevant, it only means that you don't have any mailer installed and that cron tries to send the result by email.
You can discard if by installing postfix or disable email notification in crond. (just add MAILTO="" at the begining of your crontab).


Quote:
Originally Posted by surekag View Post
And also I didnt schedule anything in /etc/cron.hourly, But in the log file it is displaying as
Feb 12 07:17:01 h2112419 CRON[6583]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)[/CODE]
for every hour.how to remove this.
This is a normal behavior. If you want to disable the hourly crontab, just comment out the line in /etc/crontab :
Code:
25 6    * * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
About you faulty cron job, I suggest that you redirect the output to a temporary log so as to see if it's executed and if it crashed :

Code:
crontab -e
00 11 * * * /path/to/script > /tmp/mylog 2>&1
 
1 members found this post helpful.
Old 02-12-2014, 08:15 AM   #5
surekag
LQ Newbie
 
Registered: Feb 2014
Posts: 3

Original Poster
Rep: Reputation: Disabled
@akiuni thank you very much.
The log file solved my problem. There was an error in connecting to database. I modified the code then it works perfectly.
 
  


Reply



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
Debian daily cron job won't run, but does run in cron.hourly. sandersch Linux - General 7 05-24-2012 01:50 AM
Webmin - Scheduled Cron Job - Password! tfranklin Linux - Server 5 01-20-2010 07:08 PM
Will my cron job run if i am not logged into the server? mthaha Linux - Desktop 3 10-13-2006 10:17 AM
Cron - doesn't seem to run scheduled tasks robintw Linux - General 11 11-25-2005 01:53 AM
What does cron do if machine is down when job is scheduled? Utah Linux - Software 4 08-24-2005 07:23 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:49 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration