cleanup of whitespaces in scripts

This commit is contained in:
mdipierro
2013-03-29 02:30:15 -05:00
parent 244d3c68eb
commit 706324b9c6
15 changed files with 411 additions and 427 deletions
+108 -109
View File
@@ -48,26 +48,26 @@ DAEMON_USER=web2py
#
do_start()
{
# Return
# 0 if daemon has been started
# 1 if daemon was already running
# 2 if daemon could not be started
# Return
# 0 if daemon has been started
# 1 if daemon was already running
# 2 if daemon could not be started
# The PIDDIR should normally be created during installation. This
# fixes things just in case.
[ -d $PIDDIR ] || mkdir -p $PIDDIR
# The PIDDIR should normally be created during installation. This
# fixes things just in case.
[ -d $PIDDIR ] || mkdir -p $PIDDIR
[ -n "$DAEMON_USER" ] && chown --recursive $DAEMON_USER $PIDDIR
# Check to see if the daemon is already running.
start-stop-daemon --stop --test --quiet --pidfile $PIDFILE \
&& return 1
# Check to see if the daemon is already running.
start-stop-daemon --stop --test --quiet --pidfile $PIDFILE \
&& return 1
start-stop-daemon --start --quiet --pidfile $PIDFILE \
${DAEMON_USER:+--chuid $DAEMON_USER} --chdir $DAEMON_DIR \
--background --exec $DAEMON -- $DAEMON_ARGS \
|| return 2
start-stop-daemon --start --quiet --pidfile $PIDFILE \
${DAEMON_USER:+--chuid $DAEMON_USER} --chdir $DAEMON_DIR \
--background --exec $DAEMON -- $DAEMON_ARGS \
|| return 2
return 0;
return 0;
}
#
@@ -75,17 +75,17 @@ do_start()
#
do_stop()
{
# Return
# 0 if daemon has been stopped
# 1 if daemon was already stopped
# 2 if daemon could not be stopped
# other if a failure occurred
# Return
# 0 if daemon has been stopped
# 1 if daemon was already stopped
# 2 if daemon could not be stopped
# other if a failure occurred
start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE
RETVAL=$?
# Many daemons don't delete their pidfiles when they exit.
rm -f $PIDFILE
return "$RETVAL"
start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE
RETVAL=$?
# Many daemons don't delete their pidfiles when they exit.
rm -f $PIDFILE
return "$RETVAL"
}
#
@@ -93,37 +93,37 @@ do_stop()
#
do_restart()
{
# Return
# 0 if daemon was (re-)started
# 1 if daemon was not strated or re-started
# Return
# 0 if daemon was (re-)started
# 1 if daemon was not strated or re-started
do_stop
case "$?" in
0|1)
do_start
case "$?" in
0) RETVAL=0 ;;
1) RETVAL=1 ;; # Old process is still running
*) RETVAL=1 ;; # Failed to start
esac
;;
*) RETVAL=1 ;; # Failed to stop
esac
do_stop
case "$?" in
0|1)
do_start
case "$?" in
0) RETVAL=0 ;;
1) RETVAL=1 ;; # Old process is still running
*) RETVAL=1 ;; # Failed to start
esac
;;
*) RETVAL=1 ;; # Failed to stop
esac
return "$RETVAL"
return "$RETVAL"
}
#
# Function that sends a SIGHUP to the daemon/service
#
do_reload() {
#
# If the daemon can reload its configuration without
# restarting (for example, when it is sent a SIGHUP),
# then implement that here.
#
start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE
return 0
#
# If the daemon can reload its configuration without
# restarting (for example, when it is sent a SIGHUP),
# then implement that here.
#
start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE
return 0
}
#
@@ -131,79 +131,79 @@ do_reload() {
#
do_status()
{
# Return
# 0 if daemon is responding and OK
# 1 if daemon is not responding, but PIDFILE exists
# 2 if daemon is not responding, but LOCKFILE exists
# 3 if deamon is not running
# 4 if daemon status is unknown
# Return
# 0 if daemon is responding and OK
# 1 if daemon is not responding, but PIDFILE exists
# 2 if daemon is not responding, but LOCKFILE exists
# 3 if deamon is not running
# 4 if daemon status is unknown
# Check to see if the daemon is already running.
start-stop-daemon --stop --test --quiet --pidfile $PIDFILE \
&& return 0
[ -f $PIDFILE ] && return 1
return 3
# Check to see if the daemon is already running.
start-stop-daemon --stop --test --quiet --pidfile $PIDFILE \
&& return 0
[ -f $PIDFILE ] && return 1
return 3
}
case "$1" in
start)
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
do_start
RETVAL=$?
[ "$VERBOSE" != no ] &&
case "$RETVAL" in
0|1) log_end_msg 0 ;;
*) log_end_msg 1 ;;
esac
exit "$RETVAL"
;;
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
do_start
RETVAL=$?
[ "$VERBOSE" != no ] &&
case "$RETVAL" in
0|1) log_end_msg 0 ;;
*) log_end_msg 1 ;;
esac
exit "$RETVAL"
;;
stop)
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
do_stop
RETVAL=$?
[ "$VERBOSE" != no ] &&
case "$RETVAL" in
0|1) log_end_msg 0 ;;
*) log_end_msg 1 ;;
esac
exit "$RETVAL"
;;
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
do_stop
RETVAL=$?
[ "$VERBOSE" != no ] &&
case "$RETVAL" in
0|1) log_end_msg 0 ;;
*) log_end_msg 1 ;;
esac
exit "$RETVAL"
;;
#reload|force-reload)
#
# If do_reload() is not implemented then leave this commented out
# and leave 'force-reload' as an alias for 'restart'.
#
#[ "$VERBOSE" != no ] && log_daemon_msg "Reloading $DESC" "$NAME"
#do_reload
#RETVAL=$?
#[ "$VERBOSE" != no ] && log_end_msg $?
#exit "$RETVAL"
#;;
#
# If do_reload() is not implemented then leave this commented out
# and leave 'force-reload' as an alias for 'restart'.
#
#[ "$VERBOSE" != no ] && log_daemon_msg "Reloading $DESC" "$NAME"
#do_reload
#RETVAL=$?
#[ "$VERBOSE" != no ] && log_end_msg $?
#exit "$RETVAL"
#;;
restart|force-reload)
#
# If the "reload" option is implemented then remove the
# 'force-reload' alias
#
[ "$VERBOSE" != no ] && log_daemon_msg "Restarting $DESC" "$NAME"
do_restart
RETVAL=$?
[ "$VERBOSE" != no ] && log_end_msg "$RETVAL"
exit "$RETVAL"
;;
#
# If the "reload" option is implemented then remove the
# 'force-reload' alias
#
[ "$VERBOSE" != no ] && log_daemon_msg "Restarting $DESC" "$NAME"
do_restart
RETVAL=$?
[ "$VERBOSE" != no ] && log_end_msg "$RETVAL"
exit "$RETVAL"
;;
status)
do_status
RETVAL=$?
RETVAL=$?
[ "$VERBOSE" != no ] &&
case "$RETVAL" in
0) log_success_msg "$NAME is running" ;;
*) log_failure_msg "$NAME is not running" ;;
esac
case "$RETVAL" in
0) log_success_msg "$NAME is running" ;;
*) log_failure_msg "$NAME is not running" ;;
esac
exit "$RETVAL"
;;
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload|status}" >&2
exit 3
;;
echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload|status}" >&2
exit 3
;;
esac
:
@@ -220,4 +220,3 @@ esac
# http://refspecs.linux-foundation.org/LSB_3.2.0/LSB-Core-generic/LSB-Core-generic.pdf
# Debian Policy SysV init: http://www.debian.org/doc/debian-policy/ch-opersys.html#s-sysvinit
# Examine files in /usr/share/doc/sysv-rc/