Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
3982df9e24
|
37
rsm
37
rsm
@@ -9,11 +9,9 @@
|
|||||||
# Date: August 29, 2018
|
# Date: August 29, 2018
|
||||||
# License: MIT
|
# License: MIT
|
||||||
|
|
||||||
RSM_VERSION='v1.4.4'
|
RSM_VERSION='v1.4.0'
|
||||||
|
|
||||||
export SVDIR=${SVDIR:-/run/runit/service/}
|
export SVDIR=${SVDIR:-/run/runit/service/}
|
||||||
export LOGDIR="/var/log/"
|
|
||||||
export RSVDIR="/run/runit/service/"
|
|
||||||
export FLDIR=${FLDIR:-/etc/runit/sv/}
|
export FLDIR=${FLDIR:-/etc/runit/sv/}
|
||||||
|
|
||||||
|
|
||||||
@@ -168,10 +166,6 @@ ${colorgreen}start <service> $cr Start the service
|
|||||||
${colorgreen}stop <service> $cr Stop the service
|
${colorgreen}stop <service> $cr Stop the service
|
||||||
${colorgreen}restart <service> $cr Restart the service
|
${colorgreen}restart <service> $cr Restart the service
|
||||||
${colorgreen}reload <service> $cr Reload the service (send SIGHUP)
|
${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}
|
${coloryellow}EXAMPLES:${colorgreen}
|
||||||
${colorgreen}$progname $cr Show service status in /var/service
|
${colorgreen}$progname $cr Show service status in /var/service
|
||||||
@@ -476,7 +470,6 @@ do_enable_disable() {
|
|||||||
ret=1
|
ret=1
|
||||||
else
|
else
|
||||||
ln -s ${FLDIR}${svc} ${SVDIR}
|
ln -s ${FLDIR}${svc} ${SVDIR}
|
||||||
do_status
|
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
disable)
|
disable)
|
||||||
@@ -486,7 +479,6 @@ do_enable_disable() {
|
|||||||
ret=1
|
ret=1
|
||||||
else
|
else
|
||||||
unlink ${SVDIR}${svc}
|
unlink ${SVDIR}${svc}
|
||||||
do_status
|
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
@@ -502,6 +494,9 @@ do_enable_disable() {
|
|||||||
|
|
||||||
# show logs
|
# show logs
|
||||||
do_show_logs() {
|
do_show_logs() {
|
||||||
|
local LOGDIR="/var/log/"
|
||||||
|
local SVDIR="/run/runit/service/"
|
||||||
|
monitors_array=($(xrandr -q))
|
||||||
local cmd=$1
|
local cmd=$1
|
||||||
local svc
|
local svc
|
||||||
local ret=0
|
local ret=0
|
||||||
@@ -519,9 +514,7 @@ do_show_logs() {
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
if ! [[ -d ${SVDIR}${cmd} ]]; then
|
||||||
if [[ -f "${RSVDIR}${cmd}" ]]; then
|
|
||||||
if ! [[ -d ${RSVDIR}${cmd} ]]; then
|
|
||||||
printf "\n%20s\n" "${colorgreen}The following log files found:"
|
printf "\n%20s\n" "${colorgreen}The following log files found:"
|
||||||
local logs_files_array=($(ls /var/log/$cmd/*.*))
|
local logs_files_array=($(ls /var/log/$cmd/*.*))
|
||||||
printf "\n$colorblue"
|
printf "\n$colorblue"
|
||||||
@@ -538,11 +531,6 @@ do_show_logs() {
|
|||||||
tail -n 10 ${LOGDIR}${cmd}/*.* | more
|
tail -n 10 ${LOGDIR}${cmd}/*.* | more
|
||||||
printf "\n"
|
printf "\n"
|
||||||
fi
|
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"
|
rmsg "$ret" "[$progname $cmd $*], exit code: $ret"
|
||||||
return "$ret"
|
return "$ret"
|
||||||
@@ -550,6 +538,9 @@ do_show_logs() {
|
|||||||
|
|
||||||
# show error logs
|
# show error logs
|
||||||
do_show_err_logs() {
|
do_show_err_logs() {
|
||||||
|
local LOGDIR="/var/log/"
|
||||||
|
local SVDIR="/run/runit/service/"
|
||||||
|
monitors_array=($(xrandr -q))
|
||||||
local cmd=$1
|
local cmd=$1
|
||||||
local svc
|
local svc
|
||||||
local ret=0
|
local ret=0
|
||||||
@@ -567,10 +558,9 @@ do_show_err_logs() {
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
if [[ -f "${RSVDIR}${cmd}" ]]; then
|
if ! [[ -d ${SVDIR}${cmd} ]]; then
|
||||||
if ! [[ -d ${RSVDIR}${cmd} ]]; then
|
printf "\n%20s\n" "${colorgreen}The following log files found:"
|
||||||
printf "\n%20s\n" "${colorred}The following error log files found:"
|
local logs_files_array=($(ls /var/log/$cmd/*.*))
|
||||||
local logs_files_array=($(ls /var/log/$cmd/*error*.*))
|
|
||||||
printf "\n$colorblue"
|
printf "\n$colorblue"
|
||||||
printf '%s\n' "${logs_files_array[@]}"
|
printf '%s\n' "${logs_files_array[@]}"
|
||||||
|
|
||||||
@@ -585,11 +575,6 @@ do_show_err_logs() {
|
|||||||
tail -n 10 ${LOGDIR}${cmd}/*error*.* | more
|
tail -n 10 ${LOGDIR}${cmd}/*error*.* | more
|
||||||
printf "\n"
|
printf "\n"
|
||||||
fi
|
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"
|
rmsg "$ret" "[$progname $cmd $*], exit code: $ret"
|
||||||
return "$ret"
|
return "$ret"
|
||||||
|
Reference in New Issue
Block a user