Superb quality and spec AB-Com PULSe 4K SE. Crazy offer! Only £129! FREE UK DELIVERY! 4K UHD, Enigma 2, Multiboot 4 images & more!...
Superb quality and spec AB-Com PULSe 4K Rev II Twin Satellite tuner only £179! FREE UK DELIVERY! 4K UHD, Enigma 2, SATA HDD facility, Multiboot 4 images & more!...

Cron manager

  • Thread starter Thread starter motoru
  • Start date Start date
I've been trying to make (back-up) copy from the network > Hades012 box with rsync (installed separatelly) using Cron witn no success.
The command # rsync -avz "/media/autofs/NetDisk/Folder1/" "/media/hdd/DiskBackUp/Folder1"
works nicely. I've tried to introduce couple of other folder copies as a BackUp-script and let Cron run it.

1st problem: The script works manually _if_ I do not start it with '#!/bin/sh' or I get '-sh: script: not found' - is this needed 'cause,
just putting to BackUp

rsync -avz "/media/autofs/NetDisk/Folder1/" "/media/hdd/NetDiskBackUp/Folder1"
rsync -avz "/media/autofs/NetDisk/Folder2/" "/media/hdd/NetDiskBackUp/Folder2"

and running # /usr/scripts/BackUp ; works OK

Putting to Cron '00 04 * * * /usr/scripts/BackUp

doesn't work. How the script should be made and introduce in the Cron, please?
 
You don't need "#!/bin/sh" it just tells it which interpreter to use, if you're using a shell scripts it's not that important.

What does "Putting to Cron '00 04 * * * /usr/scripts/BackUp " mean? are you running 'crontab -e' to add it? are you manually adding it to a file and if so which file?

For me it would help if you gave more step by step details what you are doing.
 
I'm having the file 'BackUp' in /usr/scripts/ -folder
The BackUp -file contains following lines:

rsync -avz "/media/autofs/NetDisk/Folder1/" "/media/hdd/NetDiskBackUp/Folder1"
rsync -avz "/media/autofs/NetDisk/Folder2/" "/media/hdd/NetDiskBackUp/Folder2"

I tried to make CronManager to run the BackUp -file i.e. the commands above ones a night.

The
00 04 * * * /usr/scripts/BackUp
line is in the /etc/cron/crontabs/root -file. I've tried by adding the line via CronManager GUI as well via ftp(& tried to switch Atributes 624->755)
 
I'm tried it on my box and it's working fine (I don't use ftp though).

If you wanted to test it, you could change the script to only copy a few files and then set it to run every minute but add logging to your script, that way you can find out if it's actually running, you may want to stop and disable autostart for cron in the GUI, just in case of a problem and then start it when you are ready.

So maybe change your BackUp file to something like this.
Code:
echo "Backup Started" > /media/hdd/backuplog.txt
rsync -avz "/media/autofs/NetDisk/Folder1/" "/media/hdd/NetDiskBackUp/Folder1" >> /media/hdd/backuplog.txt
and set the crontab file to
Code:
 * * * * * /usr/scripts/BackUp

This should then create a file /media/hdd/backuplog.txt which will tell you if it has run or not, if it doesn't run you could telnet to the box and run
Code:
 tail -f /var/log/messages
and it should give some kind of error message why it's not running (You may need to wait a minute or so)
 
When I ran # /usr/scripts/BackUp
I get /media/hdd/backuplog.txt, size 134
sending incremental file list sent 185 bytes received 13 bytes 396.00 bytes/sec
total size is 418,770,989 speedup is 2,115,004.99​

but also the other 'backuplog.txt' size 15, how there can be files with the same name??? And DCC-E2's ftp show this file twice but do not deleted (even after reboot of the box)

Running via Cron-manager:
H: 00:0* /usr/scripts/BackUp

Status gets green/running but no backuplog.txt appears but running manually does (desprite that existing 15 size on)
 
I'm sorry I'm finding it hard to follow exactly what you are saying, are you able to try running the 'tail -f /var/log/messages' command from a telnet or ssh session? and then start the Cron-manager in the GUI to see if you get an error coming up? it may take up to a minute for an error to show.
 
So, here is the end of message file

Jun 25 16:43:15 ventonhdx cron.info crond[3965]: crond (busybox 1.23.1) started, log level 8
Jun 25 16:44:00 ventonhdx cron.info crond[3965]: USER root pid 3988 cmd /usr/scripts/BackUp^M
Jun 25 16:45:00 ventonhdx cron.info crond[3965]: USER root pid 4023 cmd /usr/scripts/BackUp^M
Jun 25 16:46:00 ventonhdx cron.info crond[3965]: USER root pid 4056 cmd /usr/scripts/BackUp^M
Jun 25 16:47:00 ventonhdx cron.info crond[3965]: USER root pid 4088 cmd /usr/scripts/BackUp^M​

but the BackUp script do no start, the rsync target directory remains empty.
Telnet # /usr/scripts/BackUp
works. To the target directory new folders&files are created
 
Last edited:
It sounds like your /etc/cron/crontabs/root has ^M at the end of it, this would normally only happen if you created the file in Windows.
try running the following command from the telnet prompt
Code:
sed -i 's/^M//g' /etc/cron/crontabs/root
and then see what happens, if it fixes it you may want to use a program like Notepad++ to create files in Windows in the future.
 
I've just checked and I can't paste the command exactly how it should be in to the forum, so that sed line won't work.

Another way you can remove the ^M from the end of the file is to run,
Code:
vi /etc/cron/crontabs/root
use the arrow keys to move to the end of the line then press the 'delete' key to remove the ^M , then type ":wq" and [Enter] (without the quotes)
 
Thanks :thumbsup: You're absolute correct, I'd used normal Notepad. The ^M were in the BackUp script as well and there for even making the CronMan command via GUI didn't help.

The next question please, when the script failed it generated the pseudo 'backuplog.txt' size 15, permission 644
Filezilla cannot delete, nor switch the permission

Secondly, how to kill 'tail' command it still generates that message file?
 
The tail command, you just use [CTRL] + C to stop it, the /var/log/message file will always be there 'tail' was just letting you view it in real time.
The extra file, I suspect you've created a file called backuplog.txt^M (If that is possible) try running
Code:
rm /media/hdd/backuplog.txt*
 

OpenViX Feeds Status

Back
Top