forked from linuxer/Runit-Service-Manager
		
	Compare commits
	
		
			2 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 95ebba50e3 | |||
| 0506889700 | 
| @@ -4,7 +4,7 @@ | ||||
|  | ||||
| - Terminal Commands are exactly the same as sv, but produces a beautified layout. | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| ## Manage and view runit services. | ||||
|  | ||||
|   | ||||
							
								
								
									
										74
									
								
								rsm
									
									
									
									
									
								
							
							
						
						
									
										74
									
								
								rsm
									
									
									
									
									
								
							| @@ -9,7 +9,7 @@ | ||||
| # Date: August 29, 2018 | ||||
| # License: MIT | ||||
|  | ||||
| RSM_VERSION='v1.4.3' | ||||
| RSM_VERSION='v1.4.5' | ||||
|  | ||||
| export SVDIR=${SVDIR:-/run/runit/service/} | ||||
| export LOGDIR="/var/log/" | ||||
| @@ -138,7 +138,7 @@ $progname [-u] [-d <dir>] [-h] [-t] [SUBCOMMAND] [...] | ||||
|  | ||||
| ${coloryellow}OPTIONS:${colorgreen} | ||||
| ${colorgreen}-c <yes|no|auto>         $cr Enable/disable color output, defaults to auto | ||||
| ${colorgreen}-d <dir>                 $cr Directory to look into, defaults to env SVDIR or /var/service if unset | ||||
| ${colorgreen}-d <dir>                 $cr Directory to look into, defaults to env SVDIR or /run/runit/service is unset | ||||
| ${colorgreen}-h                       $cr Print this message and exit | ||||
| ${colorgreen}-l                       $cr Show log processes, this is a shortcut for 'status -l' | ||||
| ${colorgreen}-t                       $cr Tree view, this is a shortcut for 'status -t' | ||||
| @@ -391,7 +391,9 @@ do_status() { | ||||
| 		fi | ||||
|  | ||||
| 		if [[ -n $filter && $svc != *"$filter"* ]]; then | ||||
| 			verbose "filtering out '$svc' because match '$filter'" | ||||
| 			if [[ $verbosity != 1 ]]; then | ||||
| 				verbose "filtering out '$svc' because it does not match '$filter'" | ||||
| 			fi | ||||
| 			continue | ||||
| 		fi | ||||
|  | ||||
| @@ -502,7 +504,6 @@ do_enable_disable() { | ||||
|  | ||||
| # show logs | ||||
| do_show_logs() { | ||||
| 	monitors_array=($(xrandr -q)) | ||||
| 	local cmd=$1 | ||||
| 	local svc | ||||
| 	local ret=0 | ||||
| @@ -520,22 +521,29 @@ do_show_logs() { | ||||
| 		fi | ||||
| 	done | ||||
| 	 | ||||
| 	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" | ||||
| 	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" | ||||
| 	    printf "\n${colorcyan}Log files full output:\n" | ||||
| 	    printf "${coloryellow}\n" | ||||
| 	    printf "${coloryellow}${opt}" | ||||
| 			printf "\n$colormagenta" | ||||
| 			read -n 1 -s -r -p "Press any key to continue" | ||||
| 	     | ||||
| 		tail -n 10  ${LOGDIR}${cmd}/*.* | more  | ||||
| 		printf "\n" | ||||
| 			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 | ||||
| 	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" | ||||
| @@ -561,22 +569,28 @@ do_show_err_logs() { | ||||
| 		fi | ||||
| 	done | ||||
| 	 | ||||
| 	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[@]}"  | ||||
| 	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