LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 06-15-2011, 10:07 AM   #1
abdoullah
Member
 
Registered: May 2009
Distribution: Gentoo, CentOS
Posts: 49

Rep: Reputation: 0
Crontab not executing specific script


Hi Guys,
I am running to a weird issue: for some reason when I try to run a crontab script which has these two operations:
#!/bin/sh
DATE=`date +%F`

mysqldump -v --opt --password=65eCom6 udb | bzip2 -9 > /home/backups/udb_mysql_$DATE.sql.bz2

smbclient \\\\vulcan35\\e -A=/root/.smb-credentials \
-c "cd Database_backup; lcd /home/backups; put udb_mysql_$DATE.sql.bz2; exit"

this script only do the sql backup but dont put it in the folder.

but when I reduce this script to the first sql backup only and I use another cron job to put this dump file to the folder it goes through...weird isn't it?
so 1+2 in 1 cronjob don't work but 1 in 1 cronjob and 2 in another cronjob it works perfect. any thoughts?
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 06-15-2011, 12:07 PM   #2
pingu
Senior Member
 
Registered: Jul 2004
Location: Skuttunge SWEDEN
Distribution: Debian preferably
Posts: 1,350

Rep: Reputation: 127Reputation: 127
A first guess:
The second command is executed before the first one has finished.
Solution to that: put "&&" at the end of first command.
"mysqldump -v --opt --password=65eCom6 udb | bzip2 -9 > /home/backups/udb_mysql_$DATE.sql.bz2 &&"
 
2 members found this post helpful.
Old 06-15-2011, 03:48 PM   #3
abdoullah
Member
 
Registered: May 2009
Distribution: Gentoo, CentOS
Posts: 49

Original Poster
Rep: Reputation: 0
Thanks! yup it was my guess also, i'll try and get back to you.
 
Old 06-17-2011, 02:15 PM   #4
abdoullah
Member
 
Registered: May 2009
Distribution: Gentoo, CentOS
Posts: 49

Original Poster
Rep: Reputation: 0
Thanks Pingu! the issue is just solved with the two magic "&&"
Thanks!
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Howto stop squid before executing crontab file? gardenair Linux - Server 6 03-15-2011 02:42 AM
Seems crontab is not executing script... jonaskellens Linux - Newbie 3 11-18-2010 08:20 AM
Executing PHP script in crontab (include path problems) bar338 Linux - Newbie 5 12-21-2009 02:36 PM
crontab job not executing.... mia_tech Linux - Newbie 6 08-31-2009 02:42 PM
Command for executing C program in crontab bhandu Linux - Newbie 1 07-14-2007 12:54 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 02:53 AM.

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