summaryrefslogtreecommitdiffstats
path: root/partimage/build/rc.partimaged
blob: ff915f8a8edf6b72c8ac356273f9c5ad80369539 (plain)
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
#!/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