I need your help with bash script that I’m trying to build. To keep things simple I will make it short:
The script starts running once it’s gets to run level 5 so i copied the script to /etc/rc.d/rc5.d/S99fix And it should look like this:
init 3
# Do some stuff…
init 5
rm –rf /etc/rc.d/rc5.d/S99fix
The problem is that when I reboot the machine and it gets to runlevel 5 it starts the script by running the init 3 command but there it ends… I’m killing my own script before its time. the Do some stuff, init 5, rm -rf doesn't run. Is there a way I can do what I want to do and still switch between runlevels without killing my script while doing so?
Just to add some details to this question...
- I'm using SLES 11.2
- i'm installing and configuring nvidia drivers so doing stuff in runlevel 3 is required.
- This research started as a way to do stuff to the X server while in runlevel 3 and bring it back to runlevel 5. I presume there is an option just to stop and start the xdm service. But now I've become interested to understand if switching between runlevel 3 and 5 is possible in bash script.