when I run the particular command in a console it works fine but when I run using start script..it throws error.
#!/bin/bash
# chkconfig: 2345 20 80
# description: Description comes here....
# Source function library.
. /etc/init.d/functions
start() {
# code to start app comes here
# example: daemon program_name &
daemon /root/amr/bin/LoggerServer &
daemon /root/amr/bin/mediaController -i 192.168.117.119 &
daemon /root/amr/bin/mstdaemon --daemon
daemon /root/amr/bin/pcdaemon --daemon -i ens192 -f "udp && portrange 3000-8000 && not(src host localhost)" &
daemon /root/amr/bin/stund &
daemon /root/amr/bin/tdaemon &
#/root/amr/bin/start.sh &
}
stop() {
# code to stop app comes here
# example: killproc program_name
killproc LoggerServer
killproc mediaController
killproc mstdaemon
killproc pcdaemon
killproc stund
killproc tdaemon
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
status)
# code to check status of app comes here
# example: status program_name
status LoggerServer
status mediaController
status mstdaemon
status pcdaemon
status stund
status tdaemon
;;
*)
echo "Usage: $0 {start|stop|status|restart}"
esac
exit 0
error :
/bin/bash: -c: line 0: syntax error near unexpected token `src'
/bin/bash: -c: line 0: `ulimit -S -c 0 >/dev/null 2>&1 ; /root/amr/bin/pcdaemon --daemon -i ens192 -f udp && portrange 3000-8000 && not(src host localhost)'
command line run : ./pcdaemon --daemon -i ens192 -f "udp && portrange 3000-8000 && not(src host localhost)"
/root/amr
directory contents ? It is not something that I encountered before. Care to let me know what lies in that directory ? – MelBurslan Jul 7 at 18:28&&
as a shell boolean. Maybe try single quotes instead of double, just in case? – Ulrich Schwarz Jul 7 at 18:38daemon
in/etc/init.d/functions
and it messes up the quoting while running the command. – ilkkachu Jul 7 at 18:41