Re: Run script at boot time



2010/11/14 Shahar Dag <dag@xxxxxxxxxxxxxxxxx>:
"Loïc Grenié" <loic.grenie@xxxxxxxxx>
2010/11/14 Shahar Dag <dag@xxxxxxxxxxxxxxxxx>:
Hello



On Ubuntu 8.04 I want to run a script that update some files.

I want to run the script when the computer boots.

The script takes the data from a mounted file system (it’s a network file
system).



The script is started by an entry in /etc/crontab that looks like:

@reboot root my_script

The problem is that the file system is not mounted when my_script is
called.

   /etc/rc.local is one of the last script to be called at boot. All
NFS filesystems
 should be mounted at that point. Are your NFS flesystems in /etc/fstab and
 mounted "normally" by the system or are there mounted by some custom
 way ?

Its a regular NFS filesystem mounted normally from /etc/fstab

As suggested by Nils Kassube, you can wait for the data to be present
to finish your script:

while ! -f /mnt/nfs/<whatever>
do
sleep 60
done

It won't make your boot longer:
1) If you can finish your boot with your NFS partition not mounted (and your
script waiting) launch your script in background in /etc/rc.local.
2) It you cannot finish your with your NFS partition not mounted, then your
script will wait and be launched afterward, but what else can you do ? You
can lower the sleep to sleep 1 if you want faster action.

Hope this helps,

Loïc

--
ubuntu-users mailing list
ubuntu-users@xxxxxxxxxxxxxxxx
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users



Relevant Pages