Browse code

examples: fix bashism in /bin/sh script

$/usr/bin/checkbashisms examples/sr
possible bashism in examples/sr line 41 (function names should only contain [a-z0-9_]):
sip-router_start() {
possible bashism in examples/sr line 43 ($HOST(TYPE|NAME)):
echo "before startup sip-router core found on `date` at $HOSTNAME" > $TMP
possible bashism in examples/sr line 63 (function names should only contain [a-z0-9_]):
sip-router_stop() {

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=772314

Victor Seva authored on 16/02/2015 15:13:11
Showing 1 changed files
... ...
@@ -38,9 +38,9 @@ MYDIR=$HM/core
38 38
 CORE=$MYDIR/core
39 39
 TMP=/tmp/srcore.$$
40 40
 
41
-sip-router_start() {
41
+sip_router_start() {
42 42
 	if [ -r $BIN -a -r $CORE ] ; then
43
-		echo "before startup sip-router core found on `date` at $HOSTNAME" > $TMP
43
+		echo "before startup sip-router core found on `date` at `hostname`" > $TMP
44 44
 		echo "----------------------------------" >> $TMP
45 45
 		DATE=`date "+%Y-%m-%d--%H-%M"`
46 46
 		NEWCORE=$MYDIR/core.$DATE
... ...
@@ -60,7 +60,7 @@ sip-router_start() {
60 60
 	echo
61 61
 }
62 62
 
63
-sip-router_stop() {
63
+sip_router_stop() {
64 64
 	echo "Stopping SIP router: "
65 65
 	killproc $BINNAME
66 66
 	RETVAL=$?
... ...
@@ -84,15 +84,15 @@ monit_stop() {
84 84
 # See how we were called.
85 85
 case "$1" in
86 86
   serstart)
87
-	sip-router_start
87
+	sip_router_start
88 88
 	;;
89 89
   sip-routerstop)
90
-    sip-router_stop
90
+    sip_router_stop
91 91
 	;;
92 92
   sip-routerrestart)
93
-	sip-router_stop
93
+	sip_router_stop
94 94
 	echo
95
-	sip-router_start
95
+	sip_router_start
96 96
 	;;
97 97
   start)
98 98
     monit_start