| 1 | if [scip-shell system . . `[`. -x "`whichscip-shell system . . which. chkconfig`" ] ; then |
| 2 | HAVE_CHKCONFIG=y |
| 3 | else |
| 4 | HAVE_CHKCONFIG=n |
| 5 | fi |
| 6 | |
| 7 | # Gets the chkconfig list with chkconfig direclty if HAVE_CHKCONFIG |
| 8 | # Otherwise produces the same information in another way |
| 9 | get_services_listscip-shell shell shell-project 0.0.0 get_services_list().() { |
| 10 | if [scip-shell system . . `[`. "$HAVE_CHKCONFIG" = "y" ] ; then |
| 11 | chkconfig --list | awkscip-shell system . . awk. '{print $1}' | sortscip-shell system . . sort. | uniqscip-shell system . . uniq. |
| 12 | else |
| 13 | lsscip-shell system . . ls. /etc/init.d/scip-shell filesystem . . `/etc/init.d/`. | egrepscip-shell system . . egrep. -v "(README|PRESERVE)" | xargsscip-shell system . . xargs. |
| 14 | fi |
| 15 | } |
| 16 | |
| 17 | # Gets the chkconfig level with chkconfig direclty if HAVE_CHKCONFIG |
| 18 | # Otherwise produces the same information in another way |
| 19 | get_service_runlevelsscip-shell shell shell-project 0.0.0 get_service_runlevels().() { |
| 20 | |
| 21 | local SRV=$1 |
| 22 | |
| 23 | if [scip-shell system . . `[`. "$HAVE_CHKCONFIG" = "y" ] ; then |
| 24 | chkconfig $SRV --list | awkscip-shell system . . awk. '{print $2 " " $3 " " $4 " " $5 " " $6 " " $7 " " $8}' |
| 25 | else |
| 26 | for RC in 0 1 2 3 4 5 6; do |
| 27 | RCDIR=/etc/rc$RC.d |
| 28 | if [scip-shell system . . `[`. -d $RCDIR ]; then |
| 29 | if [scip-shell system . . `[`. -f $RCDIR/S[0-9][0-9]$SRV ] ; then |
| 30 | STATE="on" |
| 31 | else |
| 32 | STATE="off" |
| 33 | fi |
| 34 | echoscip-shell system . . echo. "$RC:$STATE" |
| 35 | fi |
| 36 | done |
| 37 | fi |
| 38 | } |
| 39 | |
| 40 | # Gets a list of services matching the given state at the given runlevel |
| 41 | get_services_matchingscip-shell shell shell-project 0.0.0 get_services_matching().() { |
| 42 | local RUNLEVEL=$1 |
| 43 | local STATE=$2 |
| 44 | for S in `get_services_listscip-shell shell shell-project 0.0.0 get_services_list().`; do |
| 45 | if get_service_runlevelsscip-shell shell shell-project 0.0.0 get_service_runlevels(). $S | grepscip-shell system . . grep. $RUNLEVEL:$STATE >/dev/nullscip-shell filesystem . . `/dev/null`.; then |
| 46 | echoscip-shell system . . echo. $S |
| 47 | fi |
| 48 | done |
| 49 | } |