iprutils/init.d/iprinit
Wen Xiong 5290fcd330 ipruitls: Avoid bashisms
"command &> /dev/null" and "command >& /dev/null" are bashisms and will
fail on e.g. systems where /bin/sh is dash.  Use POSIX-compatible
alternatives.

Signed-off-by : Colin Watson <cjwatson@debian.org>
---
2014-04-03 10:33:28 -05:00

103 lines
1.9 KiB
Bash

#!/bin/sh
# Copyright (C) 2004 International Business Machines Corporation and others.
# All Rights Reserved. This program and the accompanying
# materials are made available under the terms of the
# Common Public License v1.0 which accompanies this distribution.
#
# Author: Brian King <brking@us.ibm.com>
#
# iprinit
#
# System startup script for the ipr init facility
#
### BEGIN INIT INFO
# Provides: iprinit
# Required-Start: $local_fs
# Should-Start: $remote_fs $syslog
# Required-Stop: $local_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start the ipr init daemon
# Description: Start the ipr initialization daemon
### END INIT INFO
IPRINIT=/sbin/iprinit
test -x $IPRINIT || exit 5
. /lib/lsb/init-functions
start() {
echo -n "Starting ipr initialization daemon"
if [ ! -d /sys/class/scsi_generic ] ; then
modprobe sg
fi
start_daemon $IPRINIT --daemon
RETVAL=$?
if [ $RETVAL -eq 0 ]; then
log_success_msg " "
else
log_failure_msg " "
fi
return $RETVAL
}
stop() {
echo -n "Shutting down ipr initialization daemon"
killproc $IPRINIT
RETVAL=$?
if [ $RETVAL -eq 0 ]; then
log_success_msg " "
else
log_failure_msg " "
fi
return $RETVAL
}
restart() {
$0 stop
$0 start
return $RETVAL
}
reload() {
echo -n "Reload ipr initialization daemon"
$0 stop && $0 start
return $RETVAL
}
status() {
echo -n "Checking for ipr initialization daemon: "
pidofproc $IPRINIT > /dev/null 2>&1
RETVAL=$?
if [ $RETVAL -eq 0 ]; then
log_success_msg "running"
else
log_failure_msg "unused"
fi
return $RETVAL
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
reload)
reload
;;
status)
status
;;
*)
echo "Usage: $0 {start|stop|status|restart|reload}"
exit 1
;;
esac