0

On Raspberry Pi I have a script file in /etc/init.d folder named "instore". After I execute the command

service instore restart

the omxplayer process should stop. But this is not the case. The relevant part of the script:

do_start () {
    log_daemon_msg "Starting $DAEMON_NAME daemon"
    start-stop-daemon --start --background --pidfile $PIDFILE --make-pidfile --user $DAEMON_USER --chuid $DAEMON_USER --startas $DAEMON -- $DAEMON_OPTS
    log_end_msg $?
    }

do_stop () {
    log_daemon_msg "Stopping $DAEMON_NAME daemon"
    start-stop-daemon --stop --pidfile $PIDFILE --retry 10
    killall -9 omxplayer omxplayer.bin &> /dev/null
    log_end_msg $?
    }

case "$1" in

start|stop)
    do_${1}
    ;;

restart|reload|force-reload)
    do_stop
    do_start
    ;;

status)
    status_of_proc "$DAEMON_NAME" "$DAEMON" && exit 0 || exit $?
    ;;
*)
    echo "Usage: /etc/init.d/$DAEMON_NAME {start|stop|restart|status}"
    exit 1
    ;;

If I use the command

killall -9 omxplayer

in the terminal the process always stops. Anybody knows what can be the problem?

Tibor Balogh
  • 27
  • 1
  • 7
  • Are you sure that `killall` is called? – GMichael May 06 '16 at 09:19
  • I'm not really sure but one month ago it worked. There wasn't any software update. And there wasn't any script modification or so. – Tibor Balogh May 06 '16 at 09:22
  • You haven't supplied enough information yet, for us to debug this. If do_stop() is called you will get a line in your log file. Does this happen? – Niall Cosgrove May 06 '16 at 09:50
  • is the `killall` a line you added to the script yourself? Also fyi, descriptions of the problem should go in the question rather than the comments so that people don't have to sift through all the comments in order to solve your problem. So when asked for info consider editing your question rather than adding another comment – Niall Cosgrove May 06 '16 at 10:31
  • That's a script what was made one of my colleague about eight months ago. And it always worked, but something happened with it a month ago. – Tibor Balogh May 06 '16 at 10:31
  • its not clear exactly what you are trying to achieve here. From your question you seem to be saying that when you restart a daemon called instore you wish an (unrelated?) process called omxplayer to be killed? – Niall Cosgrove May 06 '16 at 10:38
  • All I want is to stop the omxplayer with this script after a restart the service. Now when I restart it the music goes on and an other song gets started, thus two songs are being played at the same time. – Tibor Balogh May 06 '16 at 10:44

1 Answers1

0

After a service restart these line have been logged:

May 6 10:12:28 JyskEger systemd[1]: Stoppping LSB:Put a short description of the service here... 
May 6 10:12:28 JyskEger instore[14519]: Stopping instore daemon 
May 6 10:12:28 JyskEger systemd[1]: Starting LSB: Put a short description of the service here... 
May 6 10:12:28 JyskEger systemd[1]: Started LSB: Put a short description of the service here... 
May 6 10:12:28 JyskEger instore[14525]: Starting instore daemon:` 

So the starting lines are logged but the end messages are not.

Ghanima
  • 409
  • 10
  • 24
Tibor Balogh
  • 27
  • 1
  • 7
  • &>/dev/null will prevent the line from being logged. consider removing it – Niall Cosgrove May 06 '16 at 10:44
  • sorry i can't help you more, will leave this for someone who has experience with xbmc. Of course if you added xbmc to the tags in your question it might help bring it to their attention – Niall Cosgrove May 06 '16 at 11:01