From: Evan Broder Date: Sat, 22 Nov 2008 10:36:27 +0000 (-0500) Subject: Steal debathena-pyhesiodfs's ideas for invirt-remote-server, too X-Git-Tag: invirt-remote-server/0.1.4^0 X-Git-Url: http://xvm.mit.edu/gitweb/invirt/packages/invirt-remote.git/commitdiff_plain/5a4ea82e0706a8d1d57f98640a59628d0b6850fc?ds=sidebyside Steal debathena-pyhesiodfs's ideas for invirt-remote-server, too svn path=/trunk/packages/invirt-remote-server/; revision=1743 --- diff --git a/debian/changelog b/debian/changelog index 68319d3..8d7456d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +invirt-remote-server (0.1.4) unstable; urgency=low + + * Steal some init script ideas from debathena-pyhesiodfs + + -- Evan Broder Sat, 22 Nov 2008 05:31:49 -0500 + invirt-remote-server (0.1.3) unstable; urgency=low * Switched to using "raw" select expressions instead of using the ORM; diff --git a/debian/invirt-remote-server.init b/debian/invirt-remote-server.init index f9ce229..9315ed5 100755 --- a/debian/invirt-remote-server.init +++ b/debian/invirt-remote-server.init @@ -15,7 +15,8 @@ PATH=/sbin:/usr/sbin:/bin:/usr/bin NAME=invirt-remote-server DESC="the Invirt remctl configuration filesystem" DAEMON=/usr/sbin/invirt-remconffs -DAEMON_ARGS="/etc/remctl/remconffs" +MOUNTPOINT="/etc/remctl/remconffs" +DAEMON_ARGS="-f $MOUNTPOINT" PIDFILE=/var/run/$NAME.pid SCRIPTNAME=/etc/init.d/$NAME GEN_FILES=/etc/remctl/acl/web @@ -26,18 +27,31 @@ GEN_FILES=/etc/remctl/acl/web . /lib/init/gen-files.sh . /lib/init/std-init.sh +# +# Function that starts the daemon/service +# do_start() { # Return # 0 if daemon has been started # 1 if daemon was already running # 2 if daemon could not be started - gen_files - modprobe fuse - daemon --running -n $NAME && return 1 - daemon -r -O daemon.info -E daemon.err -n $NAME -U $DAEMON $DAEMON_ARGS || return 2 + + # Try to make sure fuse is setup + [ -e /dev/fuse ] || modprobe fuse || return 2 + + if cat /proc/mounts | grep " $MOUNTPOINT " >/dev/null 2>&1; then + return 1 + fi + + gen_config + + daemon -r -O daemon.info -E daemon.err -n $NAME -- $DAEMON $DAEMON_ARGS || return 2 } +# +# Function that stops the daemon/service +# do_stop() { # Return @@ -45,13 +59,21 @@ do_stop() # 1 if daemon was already stopped # 2 if daemon could not be stopped # other if a failure occurred + + if ! cat /proc/mounts | grep " $MOUNTPOINT " >/dev/null 2>&1; then + return 1 + fi + daemon --stop -n $NAME RETVAL="$?" [ "$RETVAL" = 2 ] && return 2 # Many daemons don't delete their pidfiles when they exit. rm -f $PIDFILE - umount "$DAEMON_ARGS" - return "$RETVAL" +} + +do_reload() +{ + gen_config } std_init "$1"