mcst-linux-kernel/patches-2024.06.26/ceph-iscsi-3.5/files/etc.mcst/init.d/rbd-target-gw

62 lines
1.3 KiB
Bash
Executable File

#!/bin/sh -e
### BEGIN INIT INFO
# Provides: rbd-target-gw
# Required-Start: $syslog $time $remote_fs $network rbd-target-api
# Required-Stop: $syslog $time $remote_fs $network rbd-target-api
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Setup system to export rbd images through LIO
# Description: Setup system to export rbd images through LIO
### END INIT INFO
DAEMON=/usr/bin/rbd-target-gw
NAME=rbd-target-gw
PIDFILE=/var/run/${NAME}.pid
ULIMIT=1048576
. /etc/sysconfig/rc
. ${rc_functions}
case "$1" in
start)
boot_mesg "Starting ceph-iscsi $NAME" ${NORMAL}
if [ -n "$ULIMIT" ]; then
ulimit -n $ULIMIT
ulimit -u $ULIMIT
fi
export PYTHONUNBUFFERED=TRUE
if start-stop-daemon --start --quiet --background -m --pidfile $PIDFILE --exec $DAEMON ; then
echo_ok
else
echo_failure
exit 1
fi
;;
stop)
boot_mesg "Stopping ceph-iscsi $NAME" ${NORMAL}
if start-stop-daemon --stop --quiet --oknodo --signal USR1 --pidfile $PIDFILE ; then
rm -f $PIDFILE
echo_ok
else
echo_failure
exit 1
fi
;;
restart)
boot_mesg "Restarting ceph-iscsi $NAME" ${NORMAL}
${0} stop
${0} start
;;
status)
statusproc $DAEMON && exit 0 || exit $?
;;
*)
echo "Usage: $DAEMON {start|stop|restart|status}"
exit 1
esac
exit 0