Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   ArchLinux General Discussion (http://www.linux-archive.org/archlinux-general-discussion/)
-   -   Change the daemon running loop to use a case statement. (http://www.linux-archive.org/archlinux-general-discussion/393337-change-daemon-running-loop-use-case-statement.html)

Victor Lowther 06-30-2010 09:47 PM

Change the daemon running loop to use a case statement.
 
This is shorter and easier to read.
---
rc.multi | 12 +++++-------
1 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/rc.multi b/rc.multi
index 46c18df..ec6fda6 100755
--- a/rc.multi
+++ b/rc.multi
@@ -13,13 +13,11 @@ run_hook multi_start

# 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
--
1.7.1


All times are GMT. The time now is 07:47 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.