× NETGEAR will be terminating ReadyCLOUD service by July 1st, 2023. For more details click here.
Orbi WiFi 7 RBE973
Reply

Re: Schedule a copy-script

jenzbe
Aspirant

Schedule a copy-script

Hi to all,

I'm a new ReadyNas-user with a brand new readynas ultra 6.
I also bought SABNZBd for the readynas ... but as i live in Belgium i need to check my downloadvolume each month.
At night everything i download is counted for only 50%

i now have a folder on my share called "\downloads\nzb\now" which is monitored by SABNZBd.
When a .nzb-file is placed there it is automatically downloaded.
I also have a folder called "\downloads\nzb\night" which contains 'larger' downloadfiles.

Is there a posibility to schedule a copy of *.nzb from "\downloads\nzb\night" to "\downloads\nzb\now" at lets say 0.30hours?

Can anyone help me with this?
Thank you very much!
Message 1 of 11
jenzbe
Aspirant

Re: Schedule a copy-script

no one?
Message 2 of 11
sphardy1
Apprentice

Re: Schedule a copy-script

How familiar are you with Linux? Scripting & cron?
Message 3 of 11
jenzbe
Aspirant

Re: Schedule a copy-script

not enough, but eager to learn 🙂

i'll search the forum for scripting and cron but if you can put me on the right track that would be great.
Tnx in advance!
Message 4 of 11
sphardy1
Apprentice

Re: Schedule a copy-script

Basic process is:

1. Enable root SSH access to your NAS - this will give you commandline access to the underlying linux OS so that you can make manual changes. You do this by installing the EnableRootSSH addon from http://www.readynas.com/addons. Lots of info on this forum about that and how to then access your NAS via SSH

2. Create a Shell Script on your NAS that performs the task you desire - test it well! There are lots of resources on the web about this if you search for "shell script"

3. Create a "cron job" that is a built-in scheduling mechanism for linux that allows you to run shell scripts at predefined times/intervals. (ReadyNAS devices use this facility alot to verify your disks for example). Again, lots of web resources - just search for "cron tutorial"
Message 5 of 11
jenzbe
Aspirant

Re: Schedule a copy-script

1 - Done
2 - made a script called nachttarief and placed in /Downloads/nzb/nacht
- chmod nachttarief 755
- tested it -> worked ok
3 - In /etc made a new file called cron.nachttarief
- content:
MAILTO=emailadres
15 00 * * * /Downloads/nzb/nachttarief
- then i did "crontab cron.nachttarief"

Hope to see it work tomorrow morning. Thanx a lot allready
Message 6 of 11
jenzbe
Aspirant

Re: Schedule a copy-script

Hey Sphardy,
It did not work 😞 any ideas on where to start the troubleshooting? can i find logfiles to see which/when cron-jobs were run?
Message 7 of 11
sphardy1
Apprentice

Re: Schedule a copy-script

/var/log/cron.log
Message 8 of 11
jenzbe
Aspirant

Re: Schedule a copy-script

tnx. Looks like it did run

cat cron.log:
Nov 6 00:08:01 Nas /USR/SBIN/CRON[18378]: (root) CMD ( /usr/bin/empty_exim &>/dev/null)
Nov 6 00:15:01 Nas /USR/SBIN/CRON[18468]: (root) CMD (/Downloads/nzb/nachttarief)

hmmmm, gonna remove the line with 'MAILTO'

Would u mind helping me 'live' like in remote control my pc? 🙂
Mercie pour tous votre aide? 😉
Message 9 of 11
jenzbe
Aspirant

Re: Schedule a copy-script

Sphardy did a SUPERB job explaining some stuff to me.

A quick how-to for other noobs like me 😄 :

1) First create a script (copyscript) in a directory of choice (i put it in /Downloads)

2) Edit the script (i used 'vi copyscript', while Sphardy proposed to use nano for it )
(to use nano first do: "apt-get update", then do "apt-get -f install" and answer "Y" two times)
put in the script the stuff you want but start with shbangs like this:
 #!/bin/sh

then put ur script (take in mind to use full paths!) my script needs to copy everything from the night-dir to the now-dir
mv -f /Downloads/night/* /Downloads/now

3) Make a new cron-job (this is the script you are going to schedule)
i made a cron-job called cron.nightcopy in my /etc-folder
in that cron.nightcopy i put this:
MAILTO=my@emailadres
15 00 * * * /Downloads/copyscript

(this means this script starts each day at 00:15 at night,
to learn more about cron google it or start here: http://adminschoice.com/crontab-quick-reference)

4) Schedule that cron-job by using 'crontab <filename>' in my case:
crontab cron.nightcopy

5) check your cron-jobs by using
'crontab -l'

Hope this helps some people as much as Sphardy helped me!

Regards,
JenZ
Message 10 of 11
dekkit
Aspirant

Re: Schedule a copy-script

...thanks for documenting that, its given me some ideas for improving my backups across my network (e.g. using Wake on Lan etc)
Message 11 of 11
Top Contributors
Discussion stats
  • 10 replies
  • 2683 views
  • 0 kudos
  • 3 in conversation
Announcements