realtime-setup/realtime-setup.sysvinit
Clark Williams 684db02d31 initial checkin for rawhide
Signed-off-by: Clark Williams <williams@redhat.com>
2023-07-05 08:19:59 -05:00

126 lines
2.4 KiB
Bash

#!/usr/bin/bash
#
# rt-setup - script to handle setup for running an RT kernel
#
# chkconfig: 2345 00 99
# description: This script is used to setup services for use with a \
# realtime Linux kernel \
# The main use now is to setup cgroups
# Source function library.
. /etc/rc.d/init.d/functions
prog="rt-setup"
[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
# if rt-firmware is installed
if [ -d /lib/firmware/mrg-rt-firmware ]; then
if ! grep mrg-rt-firmware /lib/udev/firmware.sh > /dev/null
then
logger -t rt-setup "adding rt-firmware to udev firmware search path"
sed -i 's#) /lib/firmware"#) /lib/firmware"\nFIRMWARE_DIRS="/lib/firmware/mrg-rt-firmware $FIRMWARE_DIRS"#' /lib/udev/firmware.sh
fi
fi
lockfile=/var/lock/subsys/$prog
isrt() {
[ -f /sys/kernel/realtime ] || return 1
return 0
}
start() {
echo -n $"Starting $prog: "
# if not running, start it up here, usually something like "daemon $exec"
if [ "$SLUB_CPU_PARTIAL" == "off" ]; then
slub_cpu_partial_off
slub_retval=$?
else
slub_retval=0
fi
echo
# Update /etc/mrg-rt-release based on the running kernel
/usr/bin/update-mrg-rt-release --update-etc
[ $slub_retval -eq 0 ] && touch $lockfile
return $slub_retval
}
stop() {
echo -n $"Stopping $prog: "
rm -f $lockfile
echo
return 0
}
restart() {
stop
start
}
reload() {
restart
}
force_reload() {
restart
}
rh_status() {
if ! isrt; then
echo "$prog: Not running on an RT kernel!"
return 1
fi
# make sure that cpusets are mounted
if ! grep cpuset /proc/mounts >/dev/null 2>&1; then
echo "$prog: cpusets not mounted!"
return 2
fi
echo "$prog: Running RT kernel with cpusets mounted"
return 0
}
rh_status_q() {
rh_status >/dev/null 2>&1
}
# if we're not running on an RT kernel then bail
#if ! isrt; then
# exit 0
#fi
case "$1" in
start)
rh_status_q && exit 0
$1
;;
stop)
rh_status_q || exit 0
$1
;;
restart)
$1
;;
reload)
rh_status_q || exit 7
$1
;;
force-reload)
force_reload
;;
status)
rh_status
;;
condrestart|try-restart)
rh_status_q || exit 0
restart
;;
*)
echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
exit 2
esac
exit $?