Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
If current track has length (unlike internet radios), and play time has exceeded it, kill its omxplayer.bin via omxwd script. omxwd kills all omxplayer.bin processes in its own process group, or just the child of an omxplayer PID supplied on command line.
- Loading branch information
Showing
3 changed files
with
46 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/sh | ||
if [ "$1" = -h ]; then | ||
cat <<EOF | ||
omxd watchdog | ||
Usage: omxwd [pid] | ||
pid Optional PID of an omxplayer process. | ||
Kills all omxplayer.bin processes in pgrp, or just the child of pid. | ||
EOF | ||
exit | ||
fi | ||
|
||
p=$1 | ||
|
||
read pid comm state ppid pgrp rest </proc/$$/stat | ||
|
||
ps -A -o pgid,ppid,pid,args | grep "^ *$pgrp" \ | ||
| while read pgid ppid pid args; do | ||
case "$args" in | ||
/usr/bin/omxplayer.bin*) [ -z "$p" -o "$p" = $ppid ] && kill -9 $pid;; | ||
esac | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters