diff options
author | Victor Lowther <victor.lowther@gmail.com> | 2010-06-07 08:04:51 -0500 |
---|---|---|
committer | Victor Lowther <victor.lowther@gmail.com> | 2010-07-11 20:23:46 -0500 |
commit | 614685b48a17d44b077b03c69a4d32b007578018 (patch) | |
tree | 0fbd3be08a9f418e4b74bb0fb38d4b718824bc10 /rc.multi | |
parent | 350cbc9ab1b2f320bfd8b7a09bda49c8f3e7f83c (diff) |
Bashify rc.multi
Change the daemon running loop to use a case statement.
This is shorter and easier to read.
Quote daemon names.
Someday, someone may have a daemon name with a space in it.
Diffstat (limited to 'rc.multi')
-rwxr-xr-x | rc.multi | 16 |
1 files changed, 7 insertions, 9 deletions
@@ -9,20 +9,18 @@ run_hook multi_start # Load sysctl variables if sysctl.conf is present -[ -r /etc/sysctl.conf ] && /sbin/sysctl -q -p &>/dev/null +[[ -r /etc/sysctl.conf ]] && /sbin/sysctl -q -p &>/dev/null # Start daemons for daemon in "${DAEMONS[@]}"; do - if [ "$daemon" = "${daemon#!}" ]; then - if [ "$daemon" = "${daemon#@}" ]; then - start_daemon $daemon - else - start_daemon_bkgd ${daemon:1} - fi - fi + case ${daemon:0:1} in + '!') continue;; # Skip this daemon. + '@') start_daemon_bkgd "${daemon#@}";; + *) start_daemon "$daemon";; + esac done -if [ -x /etc/rc.local ]; then +if [[ -x /etc/rc.local ]]; then /etc/rc.local fi |