init script ubuntu
Hello all,
I have a network with approximately 100 PCs running Ubuntu 8.04. All the PCs use autodir package because I need every user to be able to sit on any computer. Because we frequently add new users, we generate passwords, users and shadow files separately and on every boot those files are updated with rsync. Unfortunatelly on some PCs this doesn't happen. On some of them it happens when the PC starts to shutdown, which is not a problem at all, but in case of new user the PC has to be restarted in order to receive those files. The rc script has been generated with Code:
update-rc.d syncronisation defaults the script contains the following Code:
rsync --delete --delete-after -v -r -z 172.23.31.16::muskogee /opt/remote And the other interesting thing is that if I put the script in rc.local it is not executed. Thank you |
The scripts pointed to by /etc/rc[S0-6].d/S* symlinks are run on entering the associated run level. During boot, run level S is entered first, followed by whatever is set as your default run level. The default run level on ubuntu is 2 unless you have changed it.
What is the output from Code:
/bin/ls -l /etc/rc[S0-6].d/*syncronisation* |
Code:
/bin/ls -l /etc/rc[S0-6].d/*syncronisation* |
Quote:
|
First of all if the scripts are executed it could be seen in the boot process, since rsync copies 50 MB of files and the process is visible. The second is when new user is added, he cannot login before run the scripts manually or reboot and scripts are executed in the shutdown level 6. But this is not on all computes. The interesting thing is that there is no difference in computers because the installation is done using dd and disks are clones of one. I don't know really what is going on.
|
Quote:
Code:
sed -n -e "/^id:[0-9]*:initdefault:/{s/^id://;s/:.*//;p}" /etc/inittab Code:
sed: can't read /etc/inittab: No such file or directory |
You can get a bit more information by re-writing your script in conformance with boot script conventions (not tested).
Code:
#! /bin/sh It assumes your script is /etc/init.d/local_initialisation; adjust as appropriate. BTW, // is not a bash script comment. In your original script "//this replaces old passwords, shadows and users" would have been passed to init.sh as arguments where they presumably (!) had no effect. The bash comment character is # as shown in the above example. That will give you some messages on the console during boot so you can see if the script is being run. Once you have that information we can focus on either why it is not being run or why it is being run but is not doing what you want it to do. |
Quote:
|
Actually the script was placed in /opt directory and there was a link to it from /etc/rc2.d/S98syncronisation
In this manner it works on some computers. Afterwards I put it in /etc/init.d and executed update-rc.d syncronisation defaults Two slashes do not reside in the script, I put them here in the post. |
All times are GMT -5. The time now is 01:58 PM. |