[opensuse-support] wget works on CLI but not in cronjob
I have a bash script to download the files from a remote website, which contains the following line: wget -r -l 8 -nH -nv --user=user --password=password ftp://web5.pipeten.co.uk/some_folder -o /home/bob/logs/wget-log When I run the script from the command line, it works perfectly. When I run it from my crontab it doesn't because DNS lookup on web5.pipeten.co.uk fails. 30 8 * * 6 bash /home/bob/bin/bb_backup.sh What have I missed? -- Bob Williams
On 10/11/2018 11.14, Bob Williams wrote:
I have a bash script to download the files from a remote website, which contains the following line:
wget -r -l 8 -nH -nv --user=user --password=password ftp://web5.pipeten.co.uk/some_folder -o /home/bob/logs/wget-log
When I run the script from the command line, it works perfectly. When I run it from my crontab it doesn't because DNS lookup on web5.pipeten.co.uk fails.
30 8 * * 6 bash /home/bob/bin/bb_backup.sh
What have I missed?
I don't know about this particular case, but the environment you get on the script changes: most entries are dropped on cron jobs. I would write a 'host' query in the script just before wget and see if that works or also fails. -- Cheers / Saludos, Carlos E. R. (from 42.3 x86_64 "Malachite" at Telcontar)
On Sat, 10 Nov 2018 12:16:26 +0100 "Carlos E. R." <robin.listas@telefonica.net> wrote:
On 10/11/2018 11.14, Bob Williams wrote:
I have a bash script to download the files from a remote website, which contains the following line:
wget -r -l 8 -nH -nv --user=user --password=password ftp://web5.pipeten.co.uk/some_folder -o /home/bob/logs/wget-log
When I run the script from the command line, it works perfectly. When I run it from my crontab it doesn't because DNS lookup on web5.pipeten.co.uk fails.
30 8 * * 6 bash /home/bob/bin/bb_backup.sh
What have I missed?
I don't know about this particular case, but the environment you get on the script changes: most entries are dropped on cron jobs.
OK
I would write a 'host' query in the script just before wget and see if that works or also fails.
I'll give that a try. Thanks -- Bob Williams
Op zaterdag 10 november 2018 11:14:08 CET schreef Bob Williams:
I have a bash script to download the files from a remote website, which contains the following line:
wget -r -l 8 -nH -nv --user=user --password=password ftp://web5.pipeten.co.uk/some_folder -o /home/bob/logs/wget-log
When I run the script from the command line, it works perfectly. When I run it from my crontab it doesn't because DNS lookup on web5.pipeten.co.uk fails.
30 8 * * 6 bash /home/bob/bin/bb_backup.sh
What have I missed? Remove the 'bash ' part.
-- Gertjan Lettink a.k.a. Knurpht openSUSE Board Member openSUSE Forums Team -- To unsubscribe, e-mail: opensuse-support+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-support+owner@opensuse.org
Op zaterdag 10 november 2018 12:32:41 CET schreef Knurpht-openSUSE:
Op zaterdag 10 november 2018 11:14:08 CET schreef Bob Williams:
I have a bash script to download the files from a remote website, which contains the following line:
wget -r -l 8 -nH -nv --user=user --password=password ftp://web5.pipeten.co.uk/some_folder -o /home/bob/logs/wget-log
When I run the script from the command line, it works perfectly. When I run it from my crontab it doesn't because DNS lookup on web5.pipeten.co.uk fails.
30 8 * * 6 bash /home/bob/bin/bb_backup.sh
What have I missed?
Remove the 'bash ' part. O, and make sure the script is executable.
-- Gertjan Lettink a.k.a. Knurpht openSUSE Board Member openSUSE Forums Team -- To unsubscribe, e-mail: opensuse-support+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-support+owner@opensuse.org
On Sat, 10 Nov 2018 12:34:56 +0100 Knurpht-openSUSE <knurpht@opensuse.org> wrote:
What have I missed?
Remove the 'bash ' part. O, and make sure the script is executable.
Aha! Not sure what the difference is, but that will be my homework to find out. -- Bob Williams System: Linux 4.19.0-2.g09557ad-default Distro: Desktop: KDE Frameworks: 5.45.0, Qt: 5.9.4 and Plasma: 5.12.5
Op zaterdag 10 november 2018 12:45:15 CET schreef Bob Williams:
On Sat, 10 Nov 2018 12:34:56 +0100
Knurpht-openSUSE <knurpht@opensuse.org> wrote:
What have I missed?
Remove the 'bash ' part.
O, and make sure the script is executable.
Aha! Not sure what the difference is, but that will be my homework to find out. The cron line contains a space char. chmod 755 /home/bob/bin/bb_backup.sh
-- Gertjan Lettink a.k.a. Knurpht openSUSE Board Member openSUSE Forums Team -- To unsubscribe, e-mail: opensuse-support+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-support+owner@opensuse.org
On Sat, 10 Nov 2018 12:34:56 +0100 Knurpht-openSUSE <knurpht@opensuse.org> wrote:
Op zaterdag 10 november 2018 12:32:41 CET schreef Knurpht-openSUSE:
Op zaterdag 10 november 2018 11:14:08 CET schreef Bob Williams:
I have a bash script to download the files from a remote website, which contains the following line:
wget -r -l 8 -nH -nv --user=user --password=password ftp://web5.pipeten.co.uk/some_folder -o /home/bob/logs/wget-log
When I run the script from the command line, it works perfectly. When I run it from my crontab it doesn't because DNS lookup on web5.pipeten.co.uk fails.
30 8 * * 6 bash /home/bob/bin/bb_backup.sh
What have I missed?
Remove the 'bash ' part. O, and make sure the script is executable.
It works! Bob -- Bob Williams
10.11.2018 13:14, Bob Williams пишет:
I have a bash script to download the files from a remote website, which contains the following line:
wget -r -l 8 -nH -nv --user=user --password=password ftp://web5.pipeten.co.uk/some_folder -o /home/bob/logs/wget-log
When I run the script from the command line, it works perfectly. When I run it from my crontab it doesn't because DNS lookup on web5.pipeten.co.uk fails.
How do you know it? If you have mail with error from cron, post it.
30 8 * * 6 bash /home/bob/bin/bb_backup.sh
What have I missed?
participants (4)
-
Andrei Borzenkov
-
Bob Williams
-
Carlos E. R.
-
Knurpht-openSUSE