Cron Job

Status
Not open for further replies.

anjudosh

Cadet
Joined
Feb 19, 2017
Messages
5
Please help.
I have a cron job that is not working. The cron job calls a script that works fine in shell. I have placed the script in /bin. the script is
#!/bin/sh/
rsync -avz /mnt/TwoTerra/Documents /mnt/TwoFiftygig

..so its very simple.
I have set the cron job to user-root and command to /bin/testy1 (the name of the script in /bin)

The error email i receive is
/bin/testy1.sh: {rtf1ansiansicpg1252cocoartf1504cocoasubrtf820: not found
/bin/testy1.sh: 2: Syntax error: "}" unexpected

I'm using FreeNAS-11.0-RC2 (a4687be8c)

Thanks.
 

Christian 128

Dabbler
Joined
Sep 29, 2016
Messages
10
Hi,
do you try your RSYNC command alone ? for be sure they work well....

I tell you, because I have issue with RSYNC few days a go and I made many thing for try to know what is the problem..... for some on on the forum Spearfoot send me the solution he found.

I joint the solution work for me : https://forums.freenas.org/index.ph...rmissions-support-for-windows-datasets.43973/

and I joint the post I made earlier this morning about my issue with RSYNC :
https://forums.freenas.org/index.php?threads/rsync-not-all-file-are-copied.54671/

let us know if you will found solution at your bug


Regards
Christian
 

Jailer

Not strong, but bad
Joined
Sep 12, 2014
Messages
4,977
Why not make the cron job the rsync command? It's what I did, just make sure to include the path, e.g.:

/usr/local/bin/rsync -blahblah /source /destination
Same here and it works flawlessly for over a year now.
 

anjudosh

Cadet
Joined
Feb 19, 2017
Messages
5
Johnnie Black and Jailer, thank you very much. That works great.

I still don't get why the other methods don't work but that's for another day.

Thanks again.

Tony.
 

joeschmuck

Old Man
Moderator
Joined
May 28, 2011
Messages
10,994
I'm not familiar with those error messages but did you chmod +x for the script?

Also, if you are creating your own scripts you should store them on your pool (eg. /mnt/pool/scripts/) and then create a cron job to call the script this way they do not disappear after an upgrade/reboot.

Same here and it works flawlessly for over a year now.
And the same here, works for me very well and doesn't require any scripting.
 
Status
Not open for further replies.
Top