1#! /bin/sh -e
2### BEGIN INIT INFO
3# Provides:          uuidd
4# Required-Start:    $time $local_fs $remote_fs
5# Required-Stop:     $time $local_fs $remote_fs
6# Default-Start:     2 3 4 5
7# Default-Stop:      0 1 6
8# Short-Description: uuidd daemon
9# Description:       Init script for the uuid generation daemon
10### END INIT INFO
11#
12# Author:	"Theodore Ts'o" <tytso@mit.edu>
13#
14set -e
15
16PATH=/bin:/usr/bin:/sbin:/usr/sbin
17DAEMON=/usr/sbin/uuidd
18UUIDD_USER=uuidd
19UUIDD_GROUP=uuidd
20UUIDD_DIR=@localstatedir@/uuidd
21PIDFILE=$UUIDD_DIR/uuidd.pid
22
23test -x $DAEMON || exit 0
24
25. /lib/lsb/init-functions
26
27case "$1" in
28  start)
29	log_daemon_msg "Starting uuid generator" "uuidd"
30	if ! test -d $UUIDD_DIR; then
31		mkdir -p $UUIDD_DIR
32		chown -R $UUIDD_USER:$UUIDD_GROUP $UUIDD_DIR
33	fi
34	start_daemon -p $PIDFILE $DAEMON
35	log_end_msg $?
36    ;;
37  stop)
38	log_daemon_msg "Stopping uuid generator" "uuidd"
39	killproc -p $PIDFILE $DAEMON
40	log_end_msg $?
41    ;;
42  status)
43	if pidofproc -p $PIDFILE $DAEMON >/dev/null 2>&1; then
44	    echo "$DAEMON is running";
45	    exit 0;
46	else
47	    echo "$DAEMON is NOT running";
48	    if test -f $PIDFILE; then exit 2; fi
49	    exit 3;
50	fi
51    ;;
52  force-reload|restart)
53    $0 stop
54    $0 start
55    ;;
56  *)
57    echo "Usage: /etc/init.d/uuidd {start|stop|restart|force-reload}"
58    exit 1
59    ;;
60esac
61
62exit 0
63