#! /bin/sh -e ### BEGIN INIT INFO # Provides: uuidd # Required-Start: $time $local_fs $remote_fs # Required-Stop: $time $local_fs $remote_fs # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: uuidd daemon # Description: Init script for the uuid generation daemon ### END INIT INFO # # Author: "Theodore Ts'o" # set -e global PATH := '/bin:/usr/bin:/sbin:/usr/sbin' global DAEMON := '/usr/sbin/uuidd' global UUIDD_USER := 'uuidd' global UUIDD_GROUP := 'uuidd' global UUIDD_DIR := '/run/uuidd' global PIDFILE := "$UUIDD_DIR/uuidd.pid" test -x $DAEMON || exit 0 source /lib/lsb/init-functions matchstr $1 { start { log_daemon_msg "Starting uuid generator" "uuidd" if ! test -d $UUIDD_DIR { mkdir -p $UUIDD_DIR chown -R $UUIDD_USER:$UUIDD_GROUP $UUIDD_DIR } start_daemon -p $PIDFILE $DAEMON log_end_msg $Status } stop { log_daemon_msg "Stopping uuid generator" "uuidd" killproc -p $PIDFILE $DAEMON log_end_msg $Status } status { if pidofproc -p $PIDFILE $DAEMON >/dev/null !2 > !1 { echo "$DAEMON is running"; exit 0; } else { echo "$DAEMON is NOT running"; if test -f $PIDFILE { exit 2; } exit 3; } } force-reload|restart { $0 stop $0 start } * { echo "Usage: /etc/init.d/uuidd {start|stop|restart|force-reload}" exit 1 } } exit 0 (CommandList children: [ (C {(set)} {(-e)}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:PATH) op: Equal rhs: {(/bin) (Lit_Other ":") (/usr/bin) (Lit_Other ":") (/sbin) (Lit_Other ":") (/usr/sbin)} spids: [44] ) ] spids: [44] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:DAEMON) op:Equal rhs:{(/usr/sbin/uuidd)} spids:[53])] spids: [53] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:UUIDD_USER) op:Equal rhs:{(uuidd)} spids:[56])] spids: [56] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:UUIDD_GROUP) op:Equal rhs:{(uuidd)} spids:[59])] spids: [59] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:UUIDD_DIR) op:Equal rhs:{(/run/uuidd)} spids:[62])] spids: [62] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:PIDFILE) op: Equal rhs: {($ VSub_Name "$UUIDD_DIR") (/uuidd.pid)} spids: [65] ) ] spids: [65] ) (AndOr children: [(C {(test)} {(-x)} {($ VSub_Name "$DAEMON")}) (C {(exit)} {(0)})] op_id: Op_DPipe ) (C {(.)} {(/lib/lsb/init-functions)}) (Case to_match: {(DQ ($ VSub_Number "$1"))} arms: [ (case_arm pat_list: [{(start)}] action: [ (C {(log_daemon_msg)} {(DQ ("Starting uuid generator"))} {(DQ (uuidd))}) (If arms: [ (if_arm cond: [ (Sentence child: (Pipeline children: [(C {(test)} {(-d)} {($ VSub_Name "$UUIDD_DIR")})] negated: True ) terminator: ) ] action: [ (C {(mkdir)} {(-p)} {($ VSub_Name "$UUIDD_DIR")}) (C {(chown)} {(-R)} {($ VSub_Name "$UUIDD_USER") (Lit_Other ":") ($ VSub_Name "$UUIDD_GROUP")} {($ VSub_Name "$UUIDD_DIR")} ) ] spids: [-1 123] ) ] spids: [-1 144] ) (C {(start_daemon)} {(-p)} {($ VSub_Name "$PIDFILE")} {($ VSub_Name "$DAEMON")}) (C {(log_end_msg)} {($ VSub_QMark "$?")}) ] spids: [97 98 161 -1] ) (case_arm pat_list: [{(stop)}] action: [ (C {(log_daemon_msg)} {(DQ ("Stopping uuid generator"))} {(DQ (uuidd))}) (C {(killproc)} {(-p)} {($ VSub_Name "$PIDFILE")} {($ VSub_Name "$DAEMON")}) (C {(log_end_msg)} {($ VSub_QMark "$?")}) ] spids: [164 165 193 -1] ) (case_arm pat_list: [{(status)}] action: [ (If arms: [ (if_arm cond: [ (Sentence child: (SimpleCommand words: [ {(pidofproc)} {(-p)} {($ VSub_Name "$PIDFILE")} {($ VSub_Name "$DAEMON")} ] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(/dev/null)} spids: [210] ) (Redir op_id: Redir_GreatAnd fd: 2 arg_word: {(1)} spids: [213] ) ] ) terminator: ) ] action: [ (Sentence child: (C {(echo)} {(DQ ($ VSub_Name "$DAEMON") (" is running"))}) terminator: ) (Sentence child:(C {(exit)} {(0)}) terminator:) ] spids: [-1 217] ) ] else_action: [ (Sentence child: (C {(echo)} {(DQ ($ VSub_Name "$DAEMON") (" is NOT running"))}) terminator: ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(test)} {(-f)} {($ VSub_Name "$PIDFILE")}) terminator: ) ] action: [(Sentence child:(C {(exit)} {(2)}) terminator:)] spids: [-1 256] ) ] spids: [-1 263] ) (Sentence child:(C {(exit)} {(3)}) terminator:) ] spids: [235 272] ) ] spids: [196 197 275 -1] ) (case_arm pat_list: [{(force-reload)} {(restart)}] action: [(C {($ VSub_Number "$0")} {(stop)}) (C {($ VSub_Number "$0")} {(start)})] spids: [278 281 294 -1] ) (case_arm pat_list: [{(Lit_Other "*")}] action: [ (C {(echo)} {(DQ ("Usage: /etc/init.d/uuidd {start|stop|restart|force-reload}"))}) (C {(exit)} {(1)}) ] spids: [297 298 313 -1] ) ] spids: [88 94 315] ) (C {(exit)} {(0)}) ] )