Преглед изворни кода

Start postsrsd with full path to binary

Also, distinguish between script name and binary name (#4)
tags/1.1
Timo Röhling пре 10 година
родитељ
комит
682d5ad906
1 измењених фајлова са 13 додато и 12 уклоњено
  1. 13
    12
      postsrsd.rh_init.in

+ 13
- 12
postsrsd.rh_init.in Прегледај датотеку

@@ -13,11 +13,12 @@ set -e
13 13
 
14 14
 PATH=/sbin:/bin:/usr/sbin:/usr/bin
15 15
 DAEMON=@CMAKE_INSTALL_PREFIX@/sbin/@POSTSRSD@
16
-prog=@PROJECT_NAME@
16
+NAME=@PROJECT_NAME@
17
+prog=@POSTSRSD@
17 18
 DESC="Postfix Sender Rewriting Scheme daemon"
18 19
 
19
-PIDFILE=/var/run/$prog.pid
20
-SCRIPTNAME=/etc/init.d/$prog
20
+PIDFILE=/var/run/$NAME.pid
21
+SCRIPTNAME=/etc/init.d/$NAME
21 22
 
22 23
 # Gracefully exit if the package has been removed.
23 24
 test -x $DAEMON || exit 0
@@ -33,9 +34,9 @@ RUN_AS=nobody
33 34
 CHROOT=@CHROOT_DIR@
34 35
 
35 36
 # Read config file if it is present.
36
-if [ -r /etc/default/$prog ]
37
+if [ -r /etc/default/$NAME ]
37 38
 then
38
-    . /etc/default/$prog
39
+    . /etc/default/$NAME
39 40
 fi
40 41
 
41 42
 test -r "$SRS_SECRET" -a -n "$SRS_DOMAIN" || exit 0
@@ -43,11 +44,11 @@ test -r "$SRS_SECRET" -a -n "$SRS_DOMAIN" || exit 0
43 44
 do_start()
44 45
 {
45 46
 	echo -n "Starting $DESC: "
46
-	daemon $prog -4 -f"$SRS_FORWARD_PORT" -r"$SRS_REVERSE_PORT" -d"$SRS_DOMAIN" -s"$SRS_SECRET" \
47
-	             -u"$RUN_AS" -p"$PIDFILE" -c"$CHROOT" -X"$SRS_EXCLUDE_DOMAINS" -D
47
+	daemon $DAEMON -4 -f"$SRS_FORWARD_PORT" -r"$SRS_REVERSE_PORT" -d"$SRS_DOMAIN" -s"$SRS_SECRET" \
48
+	               -u"$RUN_AS" -p"$PIDFILE" -c"$CHROOT" -X"$SRS_EXCLUDE_DOMAINS" -D
48 49
 	RETVAL=$?
49 50
 	echo
50
-    	[ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog
51
+    	[ $RETVAL -eq 0 ] && touch /var/lock/subsys/$NAME
51 52
     	return $RETVAL
52 53
 }
53 54
 
@@ -57,7 +58,7 @@ do_stop()
57 58
 	killproc $prog
58 59
         RETVAL=$?
59 60
         echo
60
-        [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$prog
61
+        [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$NAME
61 62
         return $RETVAL
62 63
 }
63 64
 
@@ -69,7 +70,7 @@ case "$1" in
69 70
 	do_stop
70 71
 	;;
71 72
   status)
72
-	status $prog
73
+	status $NAME
73 74
 	;;
74 75
   restart|force-reload)
75 76
 	do_stop
@@ -78,13 +79,13 @@ case "$1" in
78 79
   reload)
79 80
 	;;
80 81
   condrestart|try-restart)
81
-	if [ -f /var/lock/subsys/$prog ]; then
82
+	if [ -f /var/lock/subsys/$NAME ]; then
82 83
 		do_stop
83 84
 		do_start
84 85
 	fi
85 86
 	;;
86 87
   *)
87
-	echo "Usage: $prog {start|stop|restart|condrestart|try-restart|reload|force-reload|status|usage}"
88
+	echo "Usage: $NAME {start|stop|restart|condrestart|try-restart|reload|force-reload|status|usage}"
88 89
 	[ "$1" = "usage" ] && exit 0
89 90
 	exit 2
90 91
 	;;

Loading…
Откажи
Сачувај