From f82cf2b45817e835b1921c78095f324cb78e37df Mon Sep 17 00:00:00 2001 From: Moritz Grimm Date: Sat, 18 Nov 2017 01:20:55 +0100 Subject: [PATCH] Add ezstream-file support for -p pidfile --- doc/ezstream-file.sh.1.in.in | 12 ++++++++++++ src/ezstream-file.sh.in | 14 +++++++++++--- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/doc/ezstream-file.sh.1.in.in b/doc/ezstream-file.sh.1.in.in index 771320a..8805bdd 100644 --- a/doc/ezstream-file.sh.1.in.in +++ b/doc/ezstream-file.sh.1.in.in @@ -22,6 +22,7 @@ .Nm .Bk -words .Op Fl hqrVv +.Op Fl p Ar pidfile .Op Fl T Ar cfg_template .Op Ar .Ek @@ -60,6 +61,17 @@ binary. .It Fl h Print a summary of available command line parameters with short descriptions and exit. +.It Fl p Ar pidfile +.Po +Passed to +.Nm ezstream . +.Pc +Write the +.Nm +process ID +.Pq a single number +to +.Ar pidfile . .It Fl q .Po Passed to diff --git a/src/ezstream-file.sh.in b/src/ezstream-file.sh.in index 59e8edd..9912e33 100644 --- a/src/ezstream-file.sh.in +++ b/src/ezstream-file.sh.in @@ -21,7 +21,7 @@ _myname="$(basename $0)" _filename_placeholder="%FILENAME%" -_opt_string="hqrT:Vv" +_opt_string="hp:qrT:Vv" print_usage() { echo "usage: ${_myname} [-hqrVv] [-T cfg_template] [file ...]" >&2 @@ -32,11 +32,12 @@ print_usage_help() cat << __EOT >&2 -h print this help and exit + -p pidfile [ezstream] write PID to pidfile -q [ezstream] suppress STDERR output from external en-/decoders -r [ezstream] show real-time stream information on stdout -T template run ezstream using template for configuration -V print the version number and exit - -v [ezstream] verbose output (use twice for more effect) + -v [ezstream] increase logging verbosity The configuration template must contain the configuration statement ${_filename_placeholder} @@ -46,6 +47,8 @@ See the ezstream-file.sh(1) manual for detailed information. __EOT } +_pidfile="" +_pidfile_arg="" _quiet="" _rtstatus="" _verbose="" @@ -65,6 +68,10 @@ do print_usage_help exit 0 ;; + -p) + _pidfile="-p" + _pidfile_arg="$2" + shift; shift ;; -q) _quiet="-q"; shift ;; -r) @@ -141,6 +148,7 @@ else done fi -${EZSTREAM} ${_quiet} ${_rtstatus} ${_verbose} -c "${_cfg}" +${EZSTREAM} ${_quiet} ${_rtstatus} ${_verbose} ${_pidfile} ${_pidfile_arg} \ + -c "${_cfg}" exit $?