4 Commits

2 changed files with 13 additions and 8 deletions

View File

@@ -21,6 +21,8 @@ Quick Examples:
- `rsm enable <svc>` - enable a service (autostart at boot)
- `rsm disable <svc>` - disable a service (no autostart at boot)
- `rsm hup <svc>` - refresh a service (`SIGHUP`)
- `rsm logs <svc>` or `rsm alllogs <svc>` - lists all logs for a service (access and error)
- `rsm errorlogs <svc>` - lists all error logs for a service
Status:

19
rsm
View File

@@ -9,9 +9,11 @@
# Date: August 29, 2018
# License: MIT
RSM_VERSION='v1.4.0'
RSM_VERSION='v1.4.2'
export SVDIR=${SVDIR:-/run/runit/service/}
export LOGDIR="/var/log/"
export RSVDIR="/run/runit/service/"
export FLDIR=${FLDIR:-/etc/runit/sv/}
@@ -166,6 +168,10 @@ ${colorgreen}start <service> $cr Start the service
${colorgreen}stop <service> $cr Stop the service
${colorgreen}restart <service> $cr Restart the service
${colorgreen}reload <service> $cr Reload the service (send SIGHUP)
${colorgreen}logs <service> $cr Outputs the service's logfilenames and their access & error logs from /var/log/<serice>/
${colorgreen}alllogs <service> $cr The same like logs <service>
${colorgreen}errorlogs <service> $cr Outputs the service's logfilenames and their errorlogs from /var/log/<serice>/
${coloryellow}EXAMPLES:${colorgreen}
${colorgreen}$progname $cr Show service status in /var/service
@@ -494,7 +500,6 @@ do_enable_disable() {
# show logs
do_show_logs() {
local LOGDIR="/var/log/"
monitors_array=($(xrandr -q))
local cmd=$1
local svc
@@ -513,7 +518,7 @@ do_show_logs() {
fi
done
if ! [[ -d ${SVDIR}${cmd} ]]; then
if ! [[ -d ${RSVDIR}${cmd} ]]; then
printf "\n%20s\n" "${colorgreen}The following log files found:"
local logs_files_array=($(ls /var/log/$cmd/*.*))
printf "\n$colorblue"
@@ -537,8 +542,6 @@ do_show_logs() {
# show error logs
do_show_err_logs() {
local LOGDIR="/var/log/"
monitors_array=($(xrandr -q))
local cmd=$1
local svc
local ret=0
@@ -556,9 +559,9 @@ do_show_err_logs() {
fi
done
if ! [[ -d ${SVDIR}${cmd} ]]; then
printf "\n%20s\n" "${colorgreen}The following log files found:"
local logs_files_array=($(ls /var/log/$cmd/*.*))
if ! [[ -d ${RSVDIR}${cmd} ]]; then
printf "\n%20s\n" "${colorred}The following error log files found:"
local logs_files_array=($(ls /var/log/$cmd/*error*.*))
printf "\n$colorblue"
printf '%s\n' "${logs_files_array[@]}"