DSM-G600, DNS-3xx and NSA-220 Hack Forum

Unfortunately no one can be told what fun_plug is - you have to see it for yourself.

You are not logged in.

Announcement

#1 2010-09-26 17:53:21

knkums
New member
Registered: 2010-09-26
Posts: 2

DNS-323: ffp 0.5: crontab is overwritten after "editcron.sh" is run

Hi:

I am running fonz fun_plug 0.5, DNS-323 version 1.09

I was successully using /ffp/start/editcron.sh to insert my own cron jobs when I was running DNS-323 firmware 1.06. Ever since I upgraded to 1.09, I am having trouble with the crontab..

I have debugged the issue and verified that the "editcron.sh" runs successfully. I also added code to dump the cron table (crontab -l) right after adding my cron job.. everything looks good.. but, when I login and issue crontab -l, I do not see the one I added.

Any help is highly appreciated.

Thanks
Kn.

Here is the ffp.log output
**** fun_plug script for DNS-323 (2008-08-11 tp@fonz.de) ****                   
Sun Sep 26 07:31:24 DST 2010                                   
ln -snf /mnt/HD_a2/ffp /ffp               
....
....
Starting /ffp/sbin/sshd                                     
* /ffp/start/rsyncd.sh ... 
/ffp/etc/rsyncd.conf: Required file not found or not readable
* /ffp/start/mediatomb.sh inactive     
* /ffp/start/kickwebs.sh ...                 
Kicking webs ...                             
* /ffp/start/lighttpd.sh ...                 
/ffp/etc/lighttpd.conf: Required file not found or not readable
* /ffp/start/inetd.sh ...                   
/ffp/etc/inetd.conf: Required file not found or not readable
* /ffp/start/editcron.sh ...                 
*  OK                     


This is what is currently scheduled
=====================

root@......:~# crontab -l
59 1 * * * /usr/sbin/daylight&
30 2 * * * /usr/sbin/stime&
*/60 * * * * /usr/sbin/getdhcp&
*/10 * * * * ddns-start&
32 2 * * * /usr/sbin/rtc -s
30 2 2 * * /usr/sbin/rtc -c


editcron.sh
=======

#!/bin/sh

CRONTXT=/mnt/HD_a2/crontab.txt
# start with existing crontab
/bin/crontab -l > $CRONTXT

# add the Rsync job to execute at 3:30 am
/bin/echo "30 3 * * * /ffp/bin/snapshot.sh > /ffp/log/snapshot.log 2>&1" >> $CRONTXT

# install the new crontab
/bin/crontab $CRONTXT

# clean up
/bin/rm $CRONTXT

Last edited by knkums (2010-09-26 17:56:03)

Offline

 

#2 2010-09-26 19:28:51

FunFiler
Member
Registered: 2010-05-23
Posts: 577

Re: DNS-323: ffp 0.5: crontab is overwritten after "editcron.sh" is run

Adding a delay to the beginning of the script has solved this issue for many people, including myself.

Try this:

Code:

#!/bin/sh

# Add a 3 minute delay to allow the system to boot before modifying the crontab entries
/ffp/bin/sleep 3m

/bin/echo "Running crontab update script"

# start with first 6 lines of existing crontab - This allows you to rerun the script manually if required
# note:  on a fresh reboot, this will always have been reset to standard
/bin/crontab -l|head -n 6 > $CRONTXT

# add the Rsync job to execute at 3:30 am
/bin/echo "30 3 * * * /ffp/bin/snapshot.sh > /ffp/log/snapshot.log 2>&1" >> $CRONTXT

# install the new crontab
/bin/crontab $CRONTXT

# clean up
/bin/rm $CRONTXT

I've also added another modification I use that allows you to rerun the script manually. This is useful if you want to add more cron jobs or edit an existing one as it captures the original 6 commands, then appends the new ones you want to add.

Code:

/bin/crontab -l|head -n 6 > $CRONTXT

Depending on your individual configuration, it seems that there can be 5 or 6 original entries (possibly other values) that need to be saved. From what you posted, 6 is the correct value.

This should almost be made into a sticky thread as the problem has come up many times lately.

Last edited by FunFiler (2010-09-27 04:56:28)


3 * (DNS-323 with 2 * 2TB) = 12TB Running FW v1.08 & FFP v0.5
Useful Links: Transmission, Transmission Remote, Automatic

Offline

 

#3 2010-09-26 19:33:26

FunFiler
Member
Registered: 2010-05-23
Posts: 577

Re: DNS-323: ffp 0.5: crontab is overwritten after "editcron.sh" is run

It also seems that you are missing some configuration files from /ffp/etc. If you aren't actually using these programs, you may want to remove the 'execute' flag on the scripts in ffp/start so that the ffp doesn't bother trying to start them up.

Last edited by FunFiler (2010-09-27 04:53:18)


3 * (DNS-323 with 2 * 2TB) = 12TB Running FW v1.08 & FFP v0.5
Useful Links: Transmission, Transmission Remote, Automatic

Offline

 

#4 2010-09-27 02:03:18

knkums
New member
Registered: 2010-09-26
Posts: 2

Re: DNS-323: ffp 0.5: crontab is overwritten after "editcron.sh" is run

Thank you!!! adding delay solved the problem..
thank you very much.

Sure, I will clean up /ffp/etc

thanks
Kn

Offline

 

#5 2010-09-27 04:52:33

FunFiler
Member
Registered: 2010-05-23
Posts: 577

Re: DNS-323: ffp 0.5: crontab is overwritten after "editcron.sh" is run

Glad I could help.


3 * (DNS-323 with 2 * 2TB) = 12TB Running FW v1.08 & FFP v0.5
Useful Links: Transmission, Transmission Remote, Automatic

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2010 PunBB