/etc/init.d/rtslib-fb-targetctl is in python-rtslib-fb 2.1.57+debian-4.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | #!/bin/bash
### BEGIN INIT INFO
# Provides: rtslib-fb-targetctl
# Required-Start: $network $local_fs $remote_fs $syslog
# Required-Stop: $local_fs $network $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start LIO targets
# Description: Loads configfs and restores LIO config with targetctl
### END INIT INFO
# Author: Thomas Goirand <zigo@debian.org>
PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="rstlib-fb targetctl"
NAME=targetctl
DAEMON=/usr/bin/${NAME}
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/rtslib-fb-targetctl
SYSTEM_USER=trove
[ -x $DAEMON ] || exit 0
. /lib/lsb/init-functions
check_configfs_module () {
if ! modprobe configfs ; then
echo "Could not load configfs module: exiting!"
exit 0
fi
sleep 10
}
check_configfs_mounted () {
WORD_TO_GREP_IN_PROCMOUNT=configfs
#echo -n "Waiting for configfs to be loaded"
NUM_RETRY=50
while ! cat /proc/mounts | grep -q ${WORD_TO_GREP_IN_PROCMOUNT} && [ "${NUM_RETRY}" != 0 ] ; do
NUM_RETRY=$(( $NUM_RETRY - 1 ))
#echo -n "."
sleep 0.1
done
if ! cat /proc/mounts | grep -q ${WORD_TO_GREP_IN_PROCMOUNT} ; then
echo " ${WORD_TO_GREP_IN_PROCMOUNT} not found in /proc/mount: exiting!"
exit 0
# else
#echo ": mounted!"
fi
}
case "$1" in
start)
check_configfs_module
check_configfs_mounted
log_daemon_msg "Loading $DESC" "$NAME"
${DAEMON} restore
if [ $? -gt 0 ] ; then
log_end_msg 1
exit 1
fi
log_end_msg 0
;;
stop)
check_configfs_module
log_daemon_msg "Unloading $DESC" "${NAME}"
${DAEMON} clear
if [ $? -gt 0 ] ; then
log_end_msg 1
exit 1
fi
log_end_msg 0
;;
restart|reload|force-reload)
$0 stop
sleep 3
$0 start
;;
status)
echo "Not supported!"
exit 1
;;
*)
echo "usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}"
exit 1
;;
esac
exit 0
|