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 2009-04-24 05:34:08

arunbav
Member
Registered: 2009-04-20
Posts: 15

Files and Directories in /home/root and cronjobs disappear on restart

I am trying to set up some cron jobs on my dns-323. I created a bin directory in /home/root put in a shell script blah.sh ( made it executable and also did a chattr +i on it for good measure.). Then I set up a chronjob via crontab -e to run blah.sh on regular intervals. The chron job seems to take  (i.e. /var/spool/cron/crontabs/root) shows the job as being scheduled. So now I restart the dns-323 (via the web interface) and when I check back /home/root the bin directory is not there neither is the chronjob entry in /var/spool/cron/crontabs/root. What gives??

Offline

 

#2 2009-04-24 08:07:53

mig
Member
From: Seattle, WA
Registered: 2006-12-21
Posts: 532

Re: Files and Directories in /home/root and cronjobs disappear on restart

arunbav wrote:

What gives??

The /root file system resides in RAM and is recreated from flash every reboot.  (see /etc/rc.sh)
If you want your changes to survive reboot, you need to create a script that applies
the changes after each reboot.

Last edited by mig (2009-04-24 08:08:44)


DNS-323 • 2x Seagate Barracuda ES 7200.10 ST3250620NS 250GB SATAII (3.0Gb/s) 7200RPM 16MB • RAID1 • FW1.03 • ext2 
Fonz's v0.3 fun_plug http://www.inreto.de/dns323/fun-plug

Offline

 

#3 2009-04-24 16:03:47

arunbav
Member
Registered: 2009-04-20
Posts: 15

Re: Files and Directories in /home/root and cronjobs disappear on restart

Thanks. I can put the shell scripts in a different system bin folder which does not get rewritten every reboot. But how do I set up the chron jobs so that they do not disappear on restart?

Offline

 

#4 2009-04-24 16:10:17

fonz
Member / Developer
From: Berlin
Registered: 2007-02-06
Posts: 1716
Website

Re: Files and Directories in /home/root and cronjobs disappear on restart

you can also move root's home directory to disk, e.g.: usermod -d /mnt/HD_a2/root root  (then run store-passwd.sh)

Offline

 

#5 2009-04-24 17:37:05

arunbav
Member
Registered: 2009-04-20
Posts: 15

Re: Files and Directories in /home/root and cronjobs disappear on restart

Fonz,
          I tried it but I get a "Could not chdir to home directory /mnt/HD_a2/root: No such file or directory". I suppose I should create the /mnt/HD_a2 directory? What should the permissions be? 755? Thanks
Arun.

Offline

 

#6 2009-04-24 17:41:10

fonz
Member / Developer
From: Berlin
Registered: 2007-02-06
Posts: 1716
Website

Re: Files and Directories in /home/root and cronjobs disappear on restart

yes, of course, 755 is ok, mkdir -p /mnt/HD_a2/root

Offline

 

#7 2009-04-24 18:16:18

mig
Member
From: Seattle, WA
Registered: 2006-12-21
Posts: 532

Re: Files and Directories in /home/root and cronjobs disappear on restart

arunbav wrote:

But how do I set up the chron jobs so that they do not disappear on restart?

One techinque is to write a script that recreates the cron jobs at each reboot, similar to the 'editcron.sh' in this post :
http://dns323.kood.org/forum/viewtopic. … 637#p28637


DNS-323 • 2x Seagate Barracuda ES 7200.10 ST3250620NS 250GB SATAII (3.0Gb/s) 7200RPM 16MB • RAID1 • FW1.03 • ext2 
Fonz's v0.3 fun_plug http://www.inreto.de/dns323/fun-plug

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2010 PunBB