Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
0506889700
|
|||
59d2325f73
|
|||
0477798c9e
|
|||
750cde1aa1
|
|||
16f8b86d1b
|
79
rsm
79
rsm
@@ -9,9 +9,11 @@
|
||||
# Date: August 29, 2018
|
||||
# License: MIT
|
||||
|
||||
RSM_VERSION='v1.4.0'
|
||||
RSM_VERSION='v1.4.4'
|
||||
|
||||
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
|
||||
@@ -470,6 +476,7 @@ do_enable_disable() {
|
||||
ret=1
|
||||
else
|
||||
ln -s ${FLDIR}${svc} ${SVDIR}
|
||||
do_status
|
||||
fi
|
||||
;;
|
||||
disable)
|
||||
@@ -479,6 +486,7 @@ do_enable_disable() {
|
||||
ret=1
|
||||
else
|
||||
unlink ${SVDIR}${svc}
|
||||
do_status
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
@@ -494,8 +502,6 @@ do_enable_disable() {
|
||||
|
||||
# show logs
|
||||
do_show_logs() {
|
||||
local LOGDIR="/var/log/"
|
||||
monitors_array=($(xrandr -q))
|
||||
local cmd=$1
|
||||
local svc
|
||||
local ret=0
|
||||
@@ -513,22 +519,29 @@ do_show_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/*.*))
|
||||
printf "\n$colorblue"
|
||||
printf '%s\n' "${logs_files_array[@]}"
|
||||
|
||||
if [[ -f "${RSVDIR}${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"
|
||||
printf '%s\n' "${logs_files_array[@]}"
|
||||
|
||||
printf "\n$colormagenta"
|
||||
read -n 1 -s -r -p "Press any key to continue"
|
||||
printf "\n$colormagenta"
|
||||
read -n 1 -s -r -p "Press any key to continue"
|
||||
|
||||
printf "\n"
|
||||
printf "\n${colorcyan}Log files full output:\n"
|
||||
printf "${coloryellow}\n"
|
||||
printf "${coloryellow}${opt}"
|
||||
printf "\n"
|
||||
printf "\n${colorcyan}Log files full output:\n"
|
||||
printf "${coloryellow}\n"
|
||||
printf "${coloryellow}${opt}"
|
||||
|
||||
tail -n 10 ${LOGDIR}${cmd}/*.* | more
|
||||
printf "\n"
|
||||
tail -n 10 ${LOGDIR}${cmd}/*.* | more
|
||||
printf "\n"
|
||||
fi
|
||||
fi
|
||||
|
||||
if ! [[ -f "${RSVDIR}${cmd}" ]]; then
|
||||
printf "\n%20s\n" "${colorred}The service's ${cmd} log files have not been found or do not exist"
|
||||
fi
|
||||
|
||||
rmsg "$ret" "[$progname $cmd $*], exit code: $ret"
|
||||
@@ -537,8 +550,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,22 +567,28 @@ 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/*.*))
|
||||
printf "\n$colorblue"
|
||||
printf '%s\n' "${logs_files_array[@]}"
|
||||
if [[ -f "${RSVDIR}${cmd}" ]]; then
|
||||
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[@]}"
|
||||
|
||||
printf "\n$colormagenta"
|
||||
read -n 1 -s -r -p "Press any key to continue"
|
||||
printf "\n$colormagenta"
|
||||
read -n 1 -s -r -p "Press any key to continue"
|
||||
|
||||
printf "\n"
|
||||
printf "\n${colorcyan}Log files full output:\n"
|
||||
printf "${coloryellow}\n"
|
||||
printf "${coloryellow}${opt}"
|
||||
printf "\n"
|
||||
printf "\n${colorcyan}Log files full output:\n"
|
||||
printf "${coloryellow}\n"
|
||||
printf "${coloryellow}${opt}"
|
||||
|
||||
tail -n 10 ${LOGDIR}${cmd}/*error*.* | more
|
||||
printf "\n"
|
||||
tail -n 10 ${LOGDIR}${cmd}/*error*.* | more
|
||||
printf "\n"
|
||||
fi
|
||||
fi
|
||||
|
||||
if ! [[ -f "${RSVDIR}${cmd}" ]]; then
|
||||
printf "\n%20s\n" "${colorred}The service's ${cmd} error log files have not been found or do not exist"
|
||||
fi
|
||||
|
||||
rmsg "$ret" "[$progname $cmd $*], exit code: $ret"
|
||||
|
Reference in New Issue
Block a user