I tried to display the list of startup scripts for the current runlevel at bootup. I wrote the following code.
rl=`runlevel | cut -d " " -f2` ls /etc/rc.d/rc$rl.d/S* | cut -d "/" -f5 sleep 10
It's working if I put this code in
But it's not working if I put it in
rc file or in a separate script file
/etc/init.d and by creating softlinks in runlevel directories.
But simple commands like follows are able to run in all the methods.
Do some commands like runlevel or piping won't work unless some of the scripts have started? Or is there something else?
And if I put my code in
rc file, my code runs before and after reboot.
- So what's the difference between
- Where exactly I need to edit those files?
Also I can find
S99local -> softlink for
rc.local in 2, 3, 4 and 5 runlevels.
Does it mean that
rc.local won't run on runlevel 1?