N
N
NortherFox2014-01-13 15:13:00
linux
NortherFox, 2014-01-13 15:13:00

How to run a cron script in a loop?

Good afternoon.
There is an elementary script for automatically downloading a fresh livecd cureit from the developer's ftp
#!/bin/bash
#Go to the desired directory
cd /media/d990ad00-6a5b-40ac-b171-6db0496c2a93/soft/_Antivirus/cureit
#Delete the old
rm file drweb-livecd -602.iso_old #Rename the
existing mv file
drweb-livecd-602.iso drweb-livecd-602.iso_old #Download
a new file
wget ftp://ftp.drweb.com/pub/drweb/livecd/drweb-livecd-.. .exit
0
When run by hand, it runs fine, but when adding a job to cron in the form of cd /home/ && sh dwnld.sh, for some unknown reason, it starts to continuously download and rewrite old files, instead of completing the script after downloading. CHADNT?
PS all this is running on the debian-based openmediavault distribution, the command to run the script is written via web-gui and it's impossible to see what line gets into crontab, crontab -e launched from the root produces emptiness.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alukardd, 2014-01-13
@NortherFox

Write in cron instead of your cd and left sh just /home/dwnld.sh. First make sure that the script has an exec bit (if this is not possible, then change the line in cron as follows: /bin/bash /home/dwnld.sh)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question