Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F164543108
D37383.id113059.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D37383.id113059.diff
View Options
diff --git a/usr.sbin/service/service.sh b/usr.sbin/service/service.sh
--- a/usr.sbin/service/service.sh
+++ b/usr.sbin/service/service.sh
@@ -42,6 +42,7 @@
echo ''
echo "-j Perform actions within the named jail"
echo '-e Show services that are enabled'
+ echo '-s Show status of (enabled) services'
echo "-R Stop and start enabled $local_startup services"
echo "-l List all scripts in /etc/rc.d and $local_startup"
echo '-r Show the results of boot time rcorder'
@@ -49,10 +50,11 @@
echo ''
}
-while getopts 'j:ehlrRv' COMMAND_LINE_ARGUMENT ; do
+while getopts 'j:eshlrRv' COMMAND_LINE_ARGUMENT ; do
case "${COMMAND_LINE_ARGUMENT}" in
j) JAIL="${OPTARG}" ;;
e) ENABLED=eopt ;;
+ s) STATUS=sopt ;;
h) usage ; exit 0 ;;
l) LIST=lopt ;;
r) RCORDER=ropt ;;
@@ -111,7 +113,7 @@
exit 0
fi
-if [ -n "$ENABLED" -o -n "$RCORDER" ]; then
+if [ -n "$ENABLED" -o -n "$RCORDER" -o -n "$STATUS" ]; then
# Copied from /etc/rc
skip="-s nostart"
if [ `/sbin/sysctl -n security.jail.jailed` -eq 1 ]; then
@@ -124,6 +126,29 @@
files=`rcorder ${skip} /etc/rc.d/* ${local_rc} 2>/dev/null`
fi
+if [ -n "$STATUS" ]; then
+ for file in $files; do
+ if grep -q ^rcvar $file; then
+ eval `grep ^name= $file`
+ eval `grep ^rcvar $file`
+ if [ -n "$rcvar" ]; then
+ load_rc_config_var ${name} ${rcvar}
+ fi
+ if [ -n "$ENABLED" ] ; then
+ if ! checkyesno $rcvar 2>/dev/null; then
+ continue;
+ fi
+ fi
+ if $file 2>&1 | grep -q "status"; then
+ status="Not running"
+ $file onestatus 1>/dev/null 2>&1 && status="Running"
+ printf "%s^%s\n" "${name}" "${status}"
+ fi
+ fi
+ done | column -ts^
+ exit 0
+fi
+
if [ -n "$ENABLED" ]; then
for file in $files; do
if grep -q ^rcvar $file; then
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Aug 3, 12:43 AM (9 h, 45 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
35874582
Default Alt Text
D37383.id113059.diff (1 KB)
Attached To
Mode
D37383: service(8): add -s for showing status
Attached
Detach File
Event Timeline
Log In to Comment