LinuxQuestions.org
Visit the LQ Articles and Editorials section
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 12-16-2009, 04:53 AM   #1
ulver
LQ Newbie
 
Registered: Mar 2008
Posts: 14

Rep: Reputation: 0
wget command runs manually but over cron doesnt


Hi, I have a command that I use for daily backup of my firewall settings which goes like this;

Code:
/usr/bin/wget -q --post-data 'Submit=download' http://user:pass@10.0.0.10/backup.php -O /home/backup/firewall/config-firewall-`date +%Y%m%d%H%M%S`.xml
Now that command works when I enter it manually but over cron it doesnt run;
this is my cron entry;

Quote:
0 6 * * * /usr/bin/wget -q --post-data 'Submit=download' http://userass@10.0.0.10/backup.php -O /home/backup/firewall/config-firewall-`date +%Y%m%d%H%M%S`.xml
 
Old 12-16-2009, 05:36 AM   #2
evo2
Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and Scientific Linux
Posts: 5,588

Rep: Reputation: 1227Reputation: 1227Reputation: 1227Reputation: 1227Reputation: 1227Reputation: 1227Reputation: 1227Reputation: 1227Reputation: 1227
Try, putting our command in a script and put this near the top:
Code:
cd $(dirname $0)
Cheers,

Evo2.

Last edited by evo2; 12-16-2009 at 05:36 AM. Reason: typo
 
Old 12-16-2009, 06:55 PM   #3
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.6, Centos 5.10
Posts: 16,324

Rep: Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041
You may need to specify the full path for the date cmd; it's not a shell built-in & cron has a minimal default PATH.
 
Old 12-24-2009, 05:26 AM   #4
ulver
LQ Newbie
 
Registered: Mar 2008
Posts: 14

Original Poster
Rep: Reputation: 0
I have specified the date command now its

Code:
0 6 * * * /usr/bin/wget -q --post-data 'Submit=download' http://user:pass@10.0.0.10/backup.php -O /home/backup/firewall/config-firewall-`/bin/date +%Y%m%d%H%M%S`.xml
But it still wont run :S
 
  


Reply

Tags
command, cron, firewall, wget


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
cron job doesnt work, it works manually scofiled83 Programming 8 05-30-2009 04:12 PM
Script not running properly in cron though runs well if run manually. linuxlover.chaitanya Linux - Newbie 4 01-15-2009 04:31 AM
Script runs fine from command line, but not when attempted from Cron hwest Linux - Newbie 8 12-11-2008 07:48 PM
Cron Job only runs when it is manually started sinister1 Linux - General 4 02-25-2008 09:35 AM
./configure command runs... but doesnt work Visual Basic Imp MEPIS 3 01-20-2007 02:33 PM


All times are GMT -5. The time now is 01:20 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration