Unfortunately no one can be told what fun_plug is - you have to see it for yourself.
You are not logged in.
hello everyone,
i've telneted to the dns-323 and deleted perhaps the crontab for the root user...
i took the following command to show the crontab:
crontab -d root
instead of
crontab -e root
can someone of you with telnet access to your box can tell me the output of
crontab -e root
so i can recover mine...
and please tell me how to set correctly own cronjobs in the dsn-323...
best regards
costal
ps: "sorry for my really bad english"
Offline
solved the problem with reflashing...
also i managed to get my own cronjob working...
regards
costal
Offline
Costal.
Did you try a reboot? A reboot should have solved it....
Offline
oooohh...
yes youre right, the crontab file gets restored after reboot...
so my cronjob is gone...
how can i make a cronjob that persists, or how can i write it back after a boot?
any ideas?
regards
costal
Offline
This is a task for fun_plug. Everything in the DNS gets restored after a reboot. Anything you want to be persistent has to be fixed by the fun_plug script.
Offline
There is a little problem with modifying crontab via fun_plug. You can't just have the
script edit the existing /var/spool/cron/crontabs/root file, because the crond process won't
know the crontab file on disk has changed and will not process the additional crontab entries.
A work around for this issue, is to use a temporary file to make your changes.
See the following code snippet...
CRONTXT=/mnt/HD_a2/crontab.txt # start with existing crontab /bin/crontab -l > $CRONTXT # make your modifications to the $CRONTXT file # this example adds a time sync script, which I wrote... # add ntp_sync.sh (system & rtc time sync with ntp server) # [runs once a day at 2:05am ] /bin/echo "5 2 * * * /mnt/HD_a2/ntp_sync.sh" >> $CRONTXT # install the new crontab /bin/crontab $CRONTXT # clean up /bin/rm $CRONTXT
Last edited by mig (2007-02-28 00:30:06)
Offline
frodo wrote:
This is a task for fun_plug. Everything in the DNS gets restored after a reboot. Anything you want to be persistent has to be fixed by the fun_plug script.
Cool, so just to confirm, all changes made by a fun_plug are made to the file system image in ram, not the rom-image -- which is always loaded every reboot?
Last edited by someguy (2007-02-25 05:04:30)
Offline
Yes configs are not stored in RAM. But be careful anyway.
Offline
Howdy,
So I would like rsync to copy all files from Volume 1 to Volume 2 at 1pm every night. I use the command manually:
rysnc -rlptDv --delete /mnt/HD_a2 /mnt/HD_b2
which is working fine, but how do I get the cronjob working? Do I just copy the code above, edit it with my rsync command, and then save it as a txt file in the root of HD_a2.... but then what? How do I run that automatically? Does it need to be in the funplug start folder?
Cheers,
Chumby
Offline
Howdy again,
Very keen to get this going... just not sure how to modify the script above for rsync and where to include it. Do I append it to the end of the fun_plug script found in the /mnt/HD_a2 ?
Any help warmly welcome.
Thanks,
Chumby
Offline
Chumby,
The above example is just a code snippet, not an actual script file.
To create a script file you can use an unix editor like vi http://en.wikipedia.org/wiki/Vi
and create a file (you can name it anything, but should end in .sh) in the
/mnt/HD_a2/fun_plug.d/start directory. In this example I'll use 'editcron.sh'
Create the 'editcron.sh' file
#vi /mnt/HD_a2/fun_plug.d/start/editcron.sh
and add the following commands to the file
#!/bin/sh CRONTXT=/mnt/HD_a2/crontab.txt # start with existing crontab /bin/crontab -l > $CRONTXT # add the Rsync job to execute at 2:05 am /bin/echo "5 2 * * * /mnt/HD_a2/fun_plug.d/bin/rsync -rlptDv --delete /mnt/HD_a2 /mnt/HD_b2" >> $CRONTXT # install the new crontab /bin/crontab $CRONTXT # clean up /bin/rm $CRONTXT
The line !#/bin/sh must be the first line in the script file 'editcron.sh'.
To have the fun_plug script execute the 'editcron.sh' file, the 'editcron.sh'
file must be executable and located in the /mnt/HD_a2/fun_plug.d/start directory
#chmod a+x /mnt/HD_a2/fun_plug.d/start/editcron.sh
After the 'editcron.sh' script is run (either manually or on boot-up)
you should see your rsync line in the output of the command
#crontab -l
If you want your rsync job to execute a another time you can look at
http://en.wikipedia.org/wiki/Cron to modify the crontab entry.
Last edited by mig (2008-01-12 09:13:43)
Offline
Thanks Mig for putting that together... managed to get it all set up.
To follow from this... is there a way I can check that my timezone on my DNS 323 is set correctly? I am in Australia. Do I edit the timezone.sh file or something?
Thanks heaps,
Chumby.
Offline
Chumby wrote:
To follow from this... is there a way I can check that my timezone on my DNS 323 is set correctly? I am in Australia. Do I edit the timezone.sh file or something?
Afaik, the DNS does not have working DST support which is why I added the timezone.sh script. You have to edit the file and set the timezone description for your area. When run, it'll set the timezone and query a timeserver (which you should also change according to your region).
But: The firmware runs two cronjobs (rtc -s and daylight) that will probably interfere. And there's the large clock drift.
To get accurate time, I removed all the cronjobs, measured the clock drift, adjusted the 'tick' value with adjtimex, and run ntpd. It's quite a lot of effort, but it seems to pay off. Winter time starts on 1st of november here, I hope, it'll work...
Instead of running ntp, running timezone.sh hourly via cron could keep your clock offset within a couple seconds. Measuring the drift and using adjtimex helps even more (mine drifts less than 5 secs a day with adjtimex -t 9665).
Offline
OK , thanks Fonz... looks a little complex for me.
I have set the time using the admin interface to sync with the clock on my computer.... it seems to work for what I need - setting a time to schedule the backup,
I tried to find the timezone for Australia, but couldn't locate that either
Thanks for you help with this entire project!
Cheers
Chumby.
Offline
Chumby wrote:
I tried to find the timezone for Australia, but couldn't locate that either
http://dns323.kood.org/forum/p3617-2007 … html#p3617
Was it Australia changing DST recently? Don't know if the above link is correct, then.
Offline
Thanks for that Fonz... I will check that link out. I am in Tasmania which is 1 hr ahead (DST) of EAST at the moment.
Just one other thing - I have the rysnc working in the crontab well now (great!), but how can I see what changes have been made during the copy. Is there a logfile created?
Thanks
Chumby.
Offline
Chumby wrote:
Just one other thing - I have the rysnc working in the crontab well now (great!), but how can I see what changes have been made during the copy. Is there a logfile created?
Cron normally sends job output via mail, but that's probably not working. You can redirect output to a file, though. Change your crontab entry to sth like:
5 2 * * * /mnt/HD_a2/fun_plug.d/bin/rsync -rlptDv --delete /mnt/HD_a2 /mnt/HD_b2 >/mnt/HD_a2/fun_plug.d/log/rsync.last.log 2>&1
I added the ">/mnt/....... 2>&1" part which will redirect normal and error output of rsync to the rsync.last.log file. Of course, you could also redirect normal and error output to different files, if you like: >/.../out.log 2>/..../err.log
Offline