375ddd1e9e
This change aims to add the foundations for CentOS support on manila-image-elements. In this patch-set, the following has been modified - Added elements for manila-centos-minimal - Added elements for centos-nfs - Added elements for centos-cifs - Renamed all elements for the different protocols to distro-protocol to facilitate automation - Modified the main script to take the distro param Follow-up patches will add centos-based elements for all other protocols supported. Change-Id: Ie1469a8b3973b9a15c3fa27688df3b7e7e8da688 Partial-Bug: #1675538
44 lines
863 B
Bash
44 lines
863 B
Bash
#!/bin/sh
|
|
|
|
SCRIPT=/usr/local/sbin/unfsd
|
|
RUNAS=root
|
|
|
|
PIDFILE=/var/run/unfs3.pid
|
|
LOGFILE=/var/log/unfs3.log
|
|
|
|
start() {
|
|
if [ -f /var/run/$PIDNAME ] && kill -0 $(cat /var/run/$PIDNAME); then
|
|
echo 'Service already running' >&2
|
|
return 1
|
|
fi
|
|
echo 'Starting service...' >&2
|
|
local CMD="$SCRIPT &> \"$LOGFILE\" & echo \$!"
|
|
su -c "$CMD" $RUNAS > "$PIDFILE"
|
|
echo 'Service started' >&2
|
|
}
|
|
|
|
stop() {
|
|
if [ ! -f "$PIDFILE" ] || ! kill -0 $(cat "$PIDFILE"); then
|
|
echo 'Service not running' >&2
|
|
return 1
|
|
fi
|
|
echo 'Stopping service...' >&2
|
|
kill -15 $(cat "$PIDFILE") && rm -f "$PIDFILE"
|
|
echo 'Service stopped' >&2
|
|
}
|
|
|
|
case "$1" in
|
|
start)
|
|
start
|
|
;;
|
|
stop)
|
|
stop
|
|
;;
|
|
restart)
|
|
stop
|
|
start
|
|
;;
|
|
*)
|
|
echo "Usage: $0 {start|stop|restart}"
|
|
esac
|