Thursday, January 17, 2013

rc.local script in Opensuse 11.


If you have commands and you wanted that while boot. In RHEL/CENTOS /etc/rc.d/rc.local but the same file is not exists in Opensue by default you have to create that using following steps.

Create the file  /etc/rc.d/rclocal
# file content #! /bin/sh


## This script simulates redhat's rc.local (Add commands at the end)

### BEGIN INIT INFO
# Provides: rclocal
# Required-Start: $local_fs $remote_fs $network
# X-UnitedLinux-Should-Start: $ALL
# Required-Stop:
# X-UnitedLinux-Should-Stop:
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Short-Description: Simulates rc.local
# Description: Simulates redhat's rc.local: contains
# commands to execute after system has booted (all services are already
# available)
### END INIT INFO

## Execute ony when service is started
case "$1" in
start)
## commands will be executed
;;
*)
exit 0
;;
esac
-----------------------------------------------------------------------------------------


Do give right permission for executable using command : chmod 777 /etc/rc.d/rclocal
Create symlink if you want ln -s  /etc/rc.d/rclocal  /etc/rc.d/rc.local

You have to Enable that service in Yast2 from command prompt, using this command.

yast2 > System > Runlevel editor > rclocal > Enable
Now you can edit file  /etc/rc.d/rc.local  add your command in script at "case $1".

Reboot and check..! Its done.!