I need to setup some sysfs properties at boot-time, but can’t find a proper way how to do this in OpenSuSe. In debian exist /etc/sysfs.conf file, which may be used for this task.
Also, i can’t find rc.local analogue in OpenSuSe. I’ve found boot.local, but it’s not an option, cos it’s executed before runlevels.
So, i’d like to know how it might be done in OpenSuSe way, or create some feature request against rc.local analogue at least.
P.S. Also, i’ve seen /etc/init.d/skeleton, but, i’d like to believe, there might be some preinstalled script for this, which can be used as simple as boot.local.
Edit the following script to suite your needs, save it as /etc/init.d/rclocal, make it executable and enable/disable it with chkconfig (or Yast -> Services).
#!/bin/sh
#
# Author: you
#
# /etc/init.d/rclocal
#
# rc.local replacement for openSUSE
#
### BEGIN INIT INFO
# Provides: rclocal
# Required-Start: nfs splash
# Should-Start:
# Required-Stop:
# Should-Stop:
# Default-Start: 3 5
# Default-Stop:
# Description: rc.local equivalent
### END INIT INFO
# Source SuSE config
. /etc/rc.status
# Shell functions sourced from /etc/rc.status:
# rc_check check and set local and overall rc status
# rc_status check and set local and overall rc status
# rc_status -v ditto but be verbose in local rc status
# rc_status -v -r ditto and clear the local rc status
# rc_failed set local and overall rc status to failed
# rc_failed <num> set local and overall rc status to <num><num>
# rc_reset clear local rc status (overall remains)
# rc_exit exit appropriate to overall rc status
# First reset status of this service
rc_reset
# Return values acc. to LSB for all commands but status:
# 0 - success
# 1 - generic or unspecified error
# 2 - invalid or excess argument(s)
# 3 - unimplemented feature (e.g. "reload")
# 4 - user had insufficient privileges
# 5 - program is not installed
# 6 - program is not configured
# 7 - program is not running
# 8--199 - reserved (8--99 LSB, 100--149 distrib, 150--199 appl)
#
# Note that starting an already running service, stopping
# or restarting a not-running service as well as the restart
# with force-reload (in case signaling is not supported) are
# considered a success.
case "$1" in
start)
echo "proceeding /etc/rc.d/rclocal ..."
# ~~~~~~~ PUT YOUR COMMANDS HERE ~~~~~~~~~~~~~~~~~~~~~~~~~
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Remember status and be verbose
rc_status -v
;;
stop)
;;
try-restart)
## Stop the service and if this succeeds (i.e. the
## service was running before), start it again.
## Note: try-restart is not (yet) part of LSB (as of 0.7.5)
$0 status >/dev/null && $0 restart
# Remember status and be quiet
rc_status
;;
restart)
## Stop the service and regardless of whether it was
## running or not, start it again.
$0 start
# Remember status and be quiet
rc_status
;;
force-reload)
## Signal the daemon to reload its config. Most daemons
## do this on signal 1 (SIGHUP).
## If it does not support it, restart.
$0 try-restart
rc_status
;;
reload)
$0 try-restart
rc_status
;;
status)
;;
*)
echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload}"
exit 1
;;
esac
rc_exit
I’ve done similar script already, based on skeleton in /etc/init.d.
But, my question is why such script doesn’t shipped with OpenSuSe?
IMHO, it’s very usable and, AFAIR, similar scripts available in most distros.
So, probably, it costs some feature request in bugzilla?