Show /var/log/messages after catsit command

This commit is contained in:
C. McEnroe 2021-09-28 17:04:04 -04:00
parent f5888b8f83
commit 3834500472
2 changed files with 25 additions and 5 deletions

View File

@ -1,4 +1,4 @@
.Dd August 16, 2020 .Dd September 28, 2021
.Dt CATSIT 8 .Dt CATSIT 8
.Os .Os
. .
@ -8,6 +8,7 @@
. .
.Sh SYNOPSIS .Sh SYNOPSIS
.Nm .Nm
.Op Fl q
.Op Fl c Ar control .Op Fl c Ar control
.Cm start|stop|restart|status|drop Ns | Ns Ar signal .Cm start|stop|restart|status|drop Ns | Ns Ar signal
.Ar service ... .Ar service ...
@ -29,6 +30,15 @@ Communication with
is unidirectional. is unidirectional.
The daemon logs any feedback The daemon logs any feedback
with syslog. with syslog.
The
.Nm
utility waits
a tenth of a second
after sending the command
then shows recent messages from
.Xr catsitd 8
in
.Pa /var/log/messages .
. .
.Pp .Pp
The arguments are as follows: The arguments are as follows:
@ -36,6 +46,10 @@ The arguments are as follows:
.It Fl c Ar control .It Fl c Ar control
Set the path of the named pipe. Set the path of the named pipe.
. .
.It Fl q
Do not show
.Pa /var/log/messages .
.
.It Cm start .It Cm start
Start any matching services Start any matching services
which are not already started. which are not already started.

View File

@ -8,18 +8,20 @@ die() {
: ${CATSITD_PIPE:='%%RUNDIR%%/catsitd.pipe'} : ${CATSITD_PIPE:='%%RUNDIR%%/catsitd.pipe'}
while getopts 'c:' opt; do quiet=
case "${opt}" in while getopts 'c:q' opt; do
case $opt in
(c) CATSITD_PIPE=$OPTARG;; (c) CATSITD_PIPE=$OPTARG;;
(q) quiet=q;;
(?) exit 1;; (?) exit 1;;
esac esac
done done
shift $((OPTIND - 1)) shift $((OPTIND - 1))
if ! [ -p "${CATSITD_PIPE}" ]; then if ! test -p "${CATSITD_PIPE}"; then
die "${CATSITD_PIPE} is not a named pipe" die "${CATSITD_PIPE} is not a named pipe"
fi fi
if ! [ -w "${CATSITD_PIPE}" ]; then if ! test -w "${CATSITD_PIPE}"; then
die "${CATSITD_PIPE} is not writable" die "${CATSITD_PIPE} is not writable"
fi fi
@ -35,3 +37,7 @@ if [ "${action}" != "${valid}" ]; then
fi fi
echo "$@" > "${CATSITD_PIPE}" echo "$@" > "${CATSITD_PIPE}"
test $quiet && exit
sleep 0.1
tail /var/log/messages | grep catsitd