]> git.ipfire.org Git - thirdparty/util-linux.git/blame - misc-utils/uuidd.rc.in
Merge branch 'meson-more-build-options' of https://github.com/jwillikers/util-linux
[thirdparty/util-linux.git] / misc-utils / uuidd.rc.in
CommitLineData
815427c7
KZ
1#! /bin/sh -e
2### BEGIN INIT INFO
3# Provides: uuidd
89c80bd2
AH
4# Required-Start: $time $local_fs $remote_fs
5# Required-Stop: $time $local_fs $remote_fs
815427c7
KZ
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
815427c7
KZ
16PATH=/bin:/usr/bin:/sbin:/usr/sbin
17DAEMON=/usr/sbin/uuidd
18UUIDD_USER=uuidd
19UUIDD_GROUP=uuidd
b3fdc48a
CH
20UUIDD_RUNSTATEDIR=@runstatedir@/uuidd
21UUIDD_LOCALSTATEDIR=@localstatedir@/lib/libuuid
22PIDFILE=$UUIDD_RUNSTATEDIR/uuidd.pid
815427c7
KZ
23
24test -x $DAEMON || exit 0
25
26. /lib/lsb/init-functions
27
28case "$1" in
29 start)
30 log_daemon_msg "Starting uuid generator" "uuidd"
b3fdc48a
CH
31 if ! test -d $UUIDD_RUNSTATEDIR; then
32 mkdir -p $UUIDD_RUNSTATEDIR
33 chown -R $UUIDD_USER:$UUIDD_GROUP $UUIDD_RUNSTATEDIR
34 fi
35 if ! test -d $UUIDD_LOCALSTATEDIR; then
36 mkdir -p $UUIDD_LOCALSTATEDIR
37 chown -R $UUIDD_USER:$UUIDD_GROUP $UUIDD_LOCALSTATEDIR
815427c7 38 fi
928601e6 39 start_daemon -p $PIDFILE $DAEMON
815427c7
KZ
40 log_end_msg $?
41 ;;
42 stop)
570a9300 43 log_daemon_msg "Stopping uuid generator" "uuidd"
815427c7
KZ
44 killproc -p $PIDFILE $DAEMON
45 log_end_msg $?
46 ;;
47 status)
48 if pidofproc -p $PIDFILE $DAEMON >/dev/null 2>&1; then
49 echo "$DAEMON is running";
50 exit 0;
51 else
52 echo "$DAEMON is NOT running";
53 if test -f $PIDFILE; then exit 2; fi
54 exit 3;
55 fi
56 ;;
57 force-reload|restart)
58 $0 stop
59 $0 start
60 ;;
61 *)
62 echo "Usage: /etc/init.d/uuidd {start|stop|restart|force-reload}"
63 exit 1
64 ;;
65esac
66
67exit 0