diff options
author | Ville Skyttä <ville.skytta@iki.fi> | 2009-12-19 15:57:03 +0200 |
---|---|---|
committer | Bill Nottingham <notting@redhat.com> | 2010-01-12 17:09:10 -0500 |
commit | 265989c6fce9523b46aa9020f241ab2450307aa4 (patch) | |
tree | 168538aa78bb8280848af13978f56fef5caf2c05 /rc.d/init.d | |
parent | d4c58cd1c84f99030c3f4778d2c64377838e0634 (diff) | |
download | initscripts-265989c6fce9523b46aa9020f241ab2450307aa4.tar initscripts-265989c6fce9523b46aa9020f241ab2450307aa4.tar.gz initscripts-265989c6fce9523b46aa9020f241ab2450307aa4.tar.bz2 initscripts-265989c6fce9523b46aa9020f241ab2450307aa4.tar.xz initscripts-265989c6fce9523b46aa9020f241ab2450307aa4.zip |
Eliminate bunch of unnecessary stat calls and command invocations.
Diffstat (limited to 'rc.d/init.d')
-rw-r--r-- | rc.d/init.d/functions | 4 | ||||
-rwxr-xr-x | rc.d/init.d/halt | 8 | ||||
-rwxr-xr-x | rc.d/init.d/killall | 6 | ||||
-rwxr-xr-x | rc.d/init.d/netfs | 4 | ||||
-rwxr-xr-x | rc.d/init.d/network | 2 |
5 files changed, 12 insertions, 12 deletions
diff --git a/rc.d/init.d/functions b/rc.d/init.d/functions index 09f11b8f..2b117d58 100644 --- a/rc.d/init.d/functions +++ b/rc.d/init.d/functions @@ -18,7 +18,7 @@ export PATH [ -z "${CONSOLETYPE:-}" ] && CONSOLETYPE="$(/sbin/consoletype)" -if [ -f /etc/sysconfig/i18n -a -z "${NOLOCALE:-}" -a -z "${LANGSH_SOURCED:-}" ] ; then +if [ -z "${NOLOCALE:-}" ] && [ -z "${LANGSH_SOURCED:-}" ] && [ -f /etc/sysconfig/i18n ] ; then . /etc/profile.d/lang.sh 2>/dev/null # avoid propagating LANGSH_SOURCED any further unset LANGSH_SOURCED @@ -157,7 +157,7 @@ __pids_var_run() { read line [ -z "$line" ] && break for p in $line ; do - [ -z "${p//[0-9]/}" -a -d "/proc/$p" ] && pid="$pid $p" + [ -z "${p//[0-9]/}" ] && [ -d "/proc/$p" ] && pid="$pid $p" done done < "$pid_file" diff --git a/rc.d/init.d/halt b/rc.d/init.d/halt index 8cb437fc..94d4fb08 100755 --- a/rc.d/init.d/halt +++ b/rc.d/init.d/halt @@ -78,7 +78,7 @@ esac # Find mdmon pid's and omit killing them OMITARGS= for i in /dev/.mdadm/*.pid; do - if [ "$i" = "mdadm.pid" -o ! -r "$i" ]; then + if [ "$i" = "mdadm.pid" ] || [ ! -r "$i" ]; then continue fi OMITARGS="$OMITARGS -o $(cat $i)" @@ -95,7 +95,7 @@ fi /sbin/halt -w # Save mixer settings, here for lack of a better place. -if [ -s /etc/alsa/alsactl.conf -a -x /sbin/alsactl -a -w /etc/asound.state ]; then +if [ -s /etc/alsa/alsactl.conf ] && [ -x /sbin/alsactl ] && [ -w /etc/asound.state ]; then action $"Saving mixer settings" /sbin/alsactl -E ALSA_CONFIG_PATH=/etc/alsa/alsactl.conf --ignore store fi @@ -188,12 +188,12 @@ elif [ -f /forcefsck ]; then fi # Shutdown UPS drivers -if [ "$command" = /sbin/halt -a -f /etc/sysconfig/ups ]; then +if [ "$command" = /sbin/halt ] && [ -f /etc/sysconfig/ups ]; then . /etc/sysconfig/ups if [ -z $POWERDOWNFLAG ]; then POWERDOWNFLAG=/etc/killpower fi - if [ "$SERVER" = "yes" -a -f $POWERDOWNFLAG ]; then + if [ "$SERVER" = "yes" ] && [ -f $POWERDOWNFLAG ]; then /sbin/upsdrvctl shutdown fi fi diff --git a/rc.d/init.d/killall b/rc.d/init.d/killall index d22982ef..c1169b10 100755 --- a/rc.d/init.d/killall +++ b/rc.d/init.d/killall @@ -24,10 +24,10 @@ for i in /var/lock/subsys/* ; do [ $subsys = network ] && continue # Bring the subsystem down. - if [ -f /etc/init.d/$subsys.init ]; then - /etc/init.d/$subsys.init stop - elif [ -f /etc/init.d/$subsys ]; then + if [ -f /etc/init.d/$subsys ]; then /etc/init.d/$subsys stop + elif [ -f /etc/init.d/$subsys.init ]; then + /etc/init.d/$subsys.init stop else rm -f "$i" fi diff --git a/rc.d/init.d/netfs b/rc.d/init.d/netfs index 17cea9f8..6294aeb9 100755 --- a/rc.d/init.d/netfs +++ b/rc.d/init.d/netfs @@ -32,7 +32,7 @@ NETDEVMTAB=$(LC_ALL=C awk '$4 ~ /_netdev/ && $2 != "/" { print $2 }' /etc/mtab) # See how we were called. case "$1" in start) - [ ! -f /var/lock/subsys/network -a ! -f /var/lock/subsys/NetworkManager ] && exit 0 + [ ! -f /var/lock/subsys/network ] && [ ! -f /var/lock/subsys/NetworkManager ] && exit 0 [ "$EUID" != "0" ] && exit 4 [ -n "$NFSFSTAB" ] && { @@ -46,7 +46,7 @@ case "$1" in if [ -f /etc/mdadm.conf ]; then mdadm -A -s fi - if [ -f /etc/multipath.conf -a -x /sbin/multipath ]; then + if [ -f /etc/multipath.conf ] && [ -x /sbin/multipath ]; then modprobe dm-multipath >/dev/null 2>&1 /sbin/multipath -v 0 if [ -x /sbin/kpartx ]; then diff --git a/rc.d/init.d/network b/rc.d/init.d/network index 52845ae3..07df54e0 100755 --- a/rc.d/init.d/network +++ b/rc.d/init.d/network @@ -34,7 +34,7 @@ fi [ -x /sbin/ip ] || exit 1 # Even if IPX is configured, without the utilities we can't do much -[ ! -x /sbin/ipx_internal_net -o ! -x /sbin/ipx_configure ] && IPX= +[ ! -x /sbin/ipx_internal_net ] || [ ! -x /sbin/ipx_configure ] && IPX= # Even if VLAN is configured, without the utility we can't do much [ ! -x /sbin/vconfig ] && VLAN= |