summaryrefslogtreecommitdiffstats
path: root/partimage/build/rc.partimaged
diff options
context:
space:
mode:
Diffstat (limited to 'partimage/build/rc.partimaged')
-rwxr-xr-xpartimage/build/rc.partimaged72
1 files changed, 72 insertions, 0 deletions
diff --git a/partimage/build/rc.partimaged b/partimage/build/rc.partimaged
new file mode 100755
index 00000000..ff915f8a
--- /dev/null
+++ b/partimage/build/rc.partimaged
@@ -0,0 +1,72 @@
+#!/bin/sh
+# $Id$
+# Runs partimage server
+
+# Where to store the images
+imagestore=/var/spool/partimaged
+
+start() {
+# Check if partimaged is already running
+ status 1>/dev/null 2>&1
+ RET=$?
+ if [ $RET -ne 0 ]; then
+ echo -n "Starting partimaged "
+ /usr/sbin/partimaged -D --dest $imagestore
+ RETVAL=$?
+ fi
+ echo
+ return $RETVAL
+}
+
+stop() {
+ echo -n "Stopping partimaged "
+ killall -TERM /usr/sbin/partimaged
+ RETVAL=$?
+ echo
+ return $RETVAL
+}
+
+status() {
+ PIDS=$(pidof partimaged)
+ if [ "$PIDS" == "" ]; then
+ echo "partimaged is not running!"
+ return 1
+ else
+ echo "partimaged is running at pid(s) ${PIDS}."
+ return 0
+ fi
+}
+
+restart() {
+ stop
+ start
+}
+
+reload() {
+ restart
+}
+
+case "$1" in
+start)
+ start
+ ;;
+stop)
+ stop
+ ;;
+reload|restart)
+ restart
+ ;;
+status)
+ status
+ ;;
+test)
+ status 1>/dev/null 2>&1
+ RET=$?
+ echo "RET= '$RET'"
+ ;;
+*)
+ echo "Usage: partimaged {start|stop|restart|status}"
+ exit 1
+esac
+
+exit $RETVAL