| 1 | #!/bin/shscip-shell filesystem . . `/bin/sh`. |
| 2 | |
| 3 | # --> Comments added by the author of this document marked by "# -->". |
| 4 | |
| 5 | # --> This is part of the 'rc' script package |
| 6 | # --> by Miquel van Smoorenburg, <[email protected]>. |
| 7 | |
| 8 | # --> This particular script seems to be Red Hat / FC specific |
| 9 | # --> (may not be present in other distributions). |
| 10 | |
| 11 | # Bring down all unneeded services that are still running |
| 12 | #+ (there shouldn't be any, so this is just a sanity check) |
| 13 | |
| 14 | for i in /var/lock/subsys/*; do |
| 15 | # --> Standard for/in loop, but since "do" is on same line, |
| 16 | # --> it is necessary to add ";". |
| 17 | # Check if the script is there. |
| 18 | [scip-shell system . . `[`. ! -f $i ] && continue |
| 19 | # --> This is a clever use of an "and list", equivalent to: |
| 20 | # --> if [ ! -f "$i" ]; then continue |
| 21 | |
| 22 | # Get the subsystem name. |
| 23 | subsys=${i#/var/lock/subsys/} |
| 24 | # --> Match variable name, which, in this case, is the file name. |
| 25 | # --> This is the exact equivalent of subsys=`basename $i`. |
| 26 | |
| 27 | # --> It gets it from the lock file name |
| 28 | # -->+ (if there is a lock file, |
| 29 | # -->+ that's proof the process has been running). |
| 30 | # --> See the "lockfile" entry, above. |
| 31 | |
| 32 | |
| 33 | # Bring the subsystem down. |
| 34 | if [scip-shell system . . `[`. -f /etc/rc.d/init.d/$subsys.init ]; then |
| 35 | /etc/rc.d/init.d/$scip-shell filesystem . . `/etc/rc.d/init.d/$subsys.init`.subsys.initscip-shell filesystem . . `/etc/rc.d/init.d/$subsys.init`. stop |
| 36 | else |
| 37 | /etc/rc.d/init.d/$scip-shell filesystem . . `/etc/rc.d/init.d/$subsys`.subsys stop |
| 38 | # --> Suspend running jobs and daemons. |
| 39 | # --> Note that "stop" is a positional parameter, |
| 40 | # -->+ not a shell builtin. |
| 41 | fi |
| 42 | done |