You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
61 lines
1000 B
Bash
61 lines
1000 B
Bash
#!/bin/bash
|
|
|
|
#########################
|
|
# VARS
|
|
#########################
|
|
|
|
pid=$$
|
|
child=""
|
|
stderrfile="/tmp/gstinspect-$pid.stderr"
|
|
errcode=0
|
|
|
|
#########################
|
|
# UTILS
|
|
#########################
|
|
|
|
function log() {
|
|
echo "[$(date '+%Y-%m-%d %H:%M:%S')] [$1] $2" >> $stderrfile
|
|
}
|
|
function newline() {
|
|
echo "" >> $stderrfile
|
|
}
|
|
function info() {
|
|
log "INFO" "$1"
|
|
}
|
|
|
|
function handle_error() {
|
|
log "ERROR" "An error occurred"
|
|
newline
|
|
errcode=1
|
|
endprocess
|
|
}
|
|
|
|
function endprocess() {
|
|
info "========================================[end gst $pid]"
|
|
newline
|
|
rm "$stderrfile"
|
|
|
|
if [[ "$child" != "" ]]; then
|
|
kill -9 "$child"
|
|
fi
|
|
|
|
exit $errcode
|
|
}
|
|
|
|
#########################
|
|
# ENTRYPOINT
|
|
#########################
|
|
|
|
trap endprocess SIGINT SIGTERM
|
|
trap handle_error ERR
|
|
|
|
newline
|
|
info "========================================[start gst-inspect $pid]"
|
|
info "GST_ARGS: $*"
|
|
|
|
/var/packages/VideoStation/target/bin/gst-inspect-1.0.orig "$@" 2> $stderrfile &
|
|
|
|
child=$!
|
|
wait $child
|
|
|
|
endprocess |