svc.e (813B)
1 #!/usr/bin/execlineb -S3 2 define BASEDIR "/etc/svc.d" 3 4 case -N -- $1 5 { # open case 6 "-a" { # open -a 7 if { eltest $# -eq 0 -a -e avail/${2} } 8 # then 9 { 10 foreground { 11 ln -sf "../avail/${2}" "run/${2}" 12 } printf "%s: '%s' activated.\n" ${0} ${2} 13 } 14 } # close -a 15 "-d" {} 16 # not sure if this regex works, will check later.lolz 17 "-s|-k" { svc.doservice ${1} ${2} } 18 "-l" { ls "${BASEDIR}/avail" } 19 "-r" { #open -r 20 ifte { eltest $# -gt 1 } 21 # then 22 { 23 set -x 24 foreground { $0 -k ${2} } 25 svc -s ${2} 26 } 27 # else 28 { 29 foreground { 30 printf "%s: please give a service name.\n" ${0} 31 } exit 1 32 } 33 } # close -r 34 35 } # close case 36 # default case 37 foreground { printf "usage: %s [-askdlr] [service]\n" ${0} } exit 1