LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 12-16-2009, 03: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, 04:36 AM   #2
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,724

Rep: Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705
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 04:36 AM. Reason: typo
 
Old 12-16-2009, 05:55 PM   #3
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,358

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
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, 04: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



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

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

All times are GMT -5. The time now is 09:48 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