Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
b17e0376bc
|
|||
250654bfdb
|
|||
edbabda2df
|
|||
9d13a0576b
|
|||
27bcdec74f
|
|||
6815946574
|
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
- Terminal Commands are exactly the same as sv, but produces a beautified layout.
|
- Terminal Commands are exactly the same as sv, but produces a beautified layout.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
## Manage and view runit services.
|
## Manage and view runit services.
|
||||||
|
|
||||||
|
106
rsm
106
rsm
@@ -2,12 +2,14 @@
|
|||||||
#
|
#
|
||||||
# Artix Linux service manager (runit)
|
# Artix Linux service manager (runit)
|
||||||
# Forked and further developed, by: linuxer <linuxer@artixlinux.org>
|
# Forked and further developed, by: linuxer <linuxer@artixlinux.org>
|
||||||
|
# Fork Date: August 15, 2020 as rsv
|
||||||
|
# Renamed and further developed as rsm from: January 10, 2021
|
||||||
#
|
#
|
||||||
# Original Author (vsv): Dave Eddy <dave@daveeddy.com>
|
# Original Author (vsv): Dave Eddy <dave@daveeddy.com>
|
||||||
# Date: August 29, 2018
|
# Date: August 29, 2018
|
||||||
# License: MIT
|
# License: MIT
|
||||||
|
|
||||||
RSM_VERSION='v1.3.8'
|
RSM_VERSION='v1.4.0'
|
||||||
|
|
||||||
export SVDIR=${SVDIR:-/run/runit/service/}
|
export SVDIR=${SVDIR:-/run/runit/service/}
|
||||||
export FLDIR=${FLDIR:-/etc/runit/sv/}
|
export FLDIR=${FLDIR:-/etc/runit/sv/}
|
||||||
@@ -119,7 +121,7 @@ usage() {
|
|||||||
|
|
||||||
cat <<EOF
|
cat <<EOF
|
||||||
$colormagenta ______ ____ __ __
|
$colormagenta ______ ____ __ __
|
||||||
$colormagenta | | \ \ / ___\ | \/ | $colorgreen Runit Service Manager ($RSM_VERSION)
|
$colormagenta | | \ \ / ___\ | \/ | $colorgreen Runit Service Manager for Artix Linux ($RSM_VERSION)
|
||||||
$colormagenta | |_/ / \____ | || | $colorgreen Source: https://gitea.artixlinux.org/linuxer/Runit-Service-Manager
|
$colormagenta | |_/ / \____ | || | $colorgreen Source: https://gitea.artixlinux.org/linuxer/Runit-Service-Manager
|
||||||
$colormagenta | | \ \ \____/ | || | $colorgreen MIT License
|
$colormagenta | | \ \ \____/ | || | $colorgreen MIT License
|
||||||
|
|
||||||
@@ -476,7 +478,7 @@ do_enable_disable() {
|
|||||||
rmsg 1 "failed to disable '$svc'"
|
rmsg 1 "failed to disable '$svc'"
|
||||||
ret=1
|
ret=1
|
||||||
else
|
else
|
||||||
unlink ${SVDIR}$svc
|
unlink ${SVDIR}${svc}
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
@@ -490,6 +492,92 @@ do_enable_disable() {
|
|||||||
return "$ret"
|
return "$ret"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# show logs
|
||||||
|
do_show_logs() {
|
||||||
|
local LOGDIR="/var/log/"
|
||||||
|
monitors_array=($(xrandr -q))
|
||||||
|
local cmd=$1
|
||||||
|
local svc
|
||||||
|
local ret=0
|
||||||
|
local file
|
||||||
|
shift
|
||||||
|
|
||||||
|
# Loop all arguments as services
|
||||||
|
msg "Running $progname $cmd $*"
|
||||||
|
|
||||||
|
for svc in "$@"; do
|
||||||
|
# Validate service name
|
||||||
|
if ! [[ $svc =~ $svc_re ]]; then
|
||||||
|
rmsg -1 "unexpected characters in name: '$svc'" >&2
|
||||||
|
continue
|
||||||
|
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[@]}"
|
||||||
|
|
||||||
|
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}"
|
||||||
|
|
||||||
|
tail -n 10 ${LOGDIR}${cmd}/*.* | more
|
||||||
|
printf "\n"
|
||||||
|
fi
|
||||||
|
|
||||||
|
rmsg "$ret" "[$progname $cmd $*], exit code: $ret"
|
||||||
|
return "$ret"
|
||||||
|
}
|
||||||
|
|
||||||
|
# show error logs
|
||||||
|
do_show_err_logs() {
|
||||||
|
local LOGDIR="/var/log/"
|
||||||
|
monitors_array=($(xrandr -q))
|
||||||
|
local cmd=$1
|
||||||
|
local svc
|
||||||
|
local ret=0
|
||||||
|
local file
|
||||||
|
shift
|
||||||
|
|
||||||
|
# Loop all arguments as services
|
||||||
|
msg "Running $progname $cmd $*"
|
||||||
|
|
||||||
|
for svc in "$@"; do
|
||||||
|
# Validate service name
|
||||||
|
if ! [[ $svc =~ $svc_re ]]; then
|
||||||
|
rmsg -1 "unexpected characters in name: '$svc'" >&2
|
||||||
|
continue
|
||||||
|
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[@]}"
|
||||||
|
|
||||||
|
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}"
|
||||||
|
|
||||||
|
tail -n 10 ${LOGDIR}${cmd}/*error*.* | more
|
||||||
|
printf "\n"
|
||||||
|
fi
|
||||||
|
|
||||||
|
rmsg "$ret" "[$progname $cmd $*], exit code: $ret"
|
||||||
|
return "$ret"
|
||||||
|
}
|
||||||
|
|
||||||
# handle any other subcommand
|
# handle any other subcommand
|
||||||
do_sv_cmd() {
|
do_sv_cmd() {
|
||||||
if (($# < 2)); then
|
if (($# < 2)); then
|
||||||
@@ -508,7 +596,7 @@ colors_set=false
|
|||||||
tree=false
|
tree=false
|
||||||
log=false
|
log=false
|
||||||
do_usage=-1
|
do_usage=-1
|
||||||
verbosity=0
|
verbosity=1
|
||||||
while getopts 'c:d:hltuvV' option; do
|
while getopts 'c:d:hltuvV' option; do
|
||||||
case "$option" in
|
case "$option" in
|
||||||
c) setcolors "$OPTARG"; colors_set=true;;
|
c) setcolors "$OPTARG"; colors_set=true;;
|
||||||
@@ -548,6 +636,16 @@ case "$cmd" in
|
|||||||
enable|disable)
|
enable|disable)
|
||||||
do_enable_disable "$cmd" "$@"
|
do_enable_disable "$cmd" "$@"
|
||||||
;;
|
;;
|
||||||
|
logs)
|
||||||
|
do_show_logs "$@"
|
||||||
|
;;
|
||||||
|
alllogs)
|
||||||
|
do_show_logs "$@"
|
||||||
|
;;
|
||||||
|
errorlogs)
|
||||||
|
do_show_err_logs "$@"
|
||||||
|
;;
|
||||||
|
|
||||||
*)
|
*)
|
||||||
if $tree; then
|
if $tree; then
|
||||||
rmsg -1 "-t can only be specified with 'status'"
|
rmsg -1 "-t can only be specified with 'status'"
|
||||||
|
Reference in New Issue
Block a user