OSDN Git Service

fixed for Ubuntu 12.04
[openpts/openpts.git] / dist / fedora.initrd.ptscd
1 #!/bin/bash
2 #
3 # Init file for the OpenPTS TCG Platform Trust Services collector daemon
4 #
5 # chkconfig: - 91 9
6 # description: OpenPTS Collector Daemon
7 #
8 # processname: ptscd
9 # config: /etc/ptscd.conf
10 # pidfile: /var/run/ptscd.pid
11 #
12 #
13
14 prog="ptscd"
15
16 # source function library
17 . /etc/rc.d/init.d/functions
18
19 # Allow anyone to run status
20 if [ "$1" = "status" ] ; then
21         status $prog
22         RETVAL=$?
23         exit $RETVAL
24 fi
25
26 # Check that we are root ... so non-root users stop here
27 test $EUID = 0  ||  exit 4
28
29 RETVAL=0
30
31 # Some variables to make the below more readable
32 PTSCD=/usr/sbin/ptscd
33 CONF_FILE=/etc/ptscd.conf
34 PID_FILE=/var/run/ptscd.pid
35
36 start()
37 {
38         test -x $PTSCD || exit 5
39         #test -f /etc/openpts.conf || exit 6
40         echo -n $"Starting $prog: "
41         $PTSCD $OPTIONS start && success || failure
42         RETVAL=$?
43         [ "$RETVAL" = 0 ] && touch /var/lock/subsys/ptscd
44         echo
45 }
46
47 stop()
48 {
49         echo -n $"Stopping $prog: "
50         killproc $prog
51         RETVAL=$?
52         [ "$RETVAL" = 0 ] && rm -f /var/lock/subsys/ptscd
53         echo
54 }
55
56 init()
57 {
58         echo -n $"Initialize $prog: "
59         $PTSCD -i start && success || failure
60         echo
61 }
62
63 reload()
64 {
65         echo -n $"Reloading $prog: "
66         killproc $prog -HUP
67         RETVAL=$?
68         echo
69 }
70
71 case "$1" in
72         init)
73                 init
74                 ;;
75         start)
76                 start
77                 ;;
78         stop)
79                 stop
80                 ;;
81         restart)
82                 #test -f /etc/openpts.conf  || exit 6
83                 stop
84                 start
85                 ;;
86         reload|force-reload)
87                 reload
88                 ;;
89         condrestart|try-restart)
90                 if [ -f /var/lock/subsys/openpts ] ; then
91                         restart
92                 fi
93                 ;;
94         *)
95                 echo $"Usage: $0 {start|stop|restart|reload|force-reload|condrestart|try-restart|status}"
96                 RETVAL=3
97 esac
98 exit $RETVAL
99
100
101 #