Prevent service to start multiple times.

Added messages if trying to start/stop already started/stopped service.
Added daemon install instructions for ubuntu.

git-svn-id: svn+ssh://svn.code.sf.net/p/ddclient/code/trunk@193 3873ddee-7413-0410-b6c4-c2c57c1ab35a
This commit is contained in:
wimpunk 2015-10-13 20:25:45 +00:00
parent 3d996f0878
commit 80046c5a23
2 changed files with 22 additions and 7 deletions

View file

@ -74,6 +74,15 @@ INSTALLATION:
## start the first time by hand
rc-service ddclient start
## For those using Ubuntu style rc files and using daemon-mode:
cp sample-etc_rc.d_init.d_ddclient.ubuntu /etc/init.d/ddclient
## enable automatic startup when booting
update-rc.d ddclient defaults
## make sure you have perl installed
apt-get install perl
## start the first time by hand
service ddclient start
## If you are not using daemon-mode, configure cron and dhcp or ppp
## as described below.

View file

@ -20,6 +20,7 @@ test -f $CONF || exit 0
case "$1" in
start)
if [ ! -f $PIDFILE ]; then
log_begin_msg "Starting ddclient..."
DELAY=`grep -v '^\s*#' $CONF | grep -i -m 1 "daemon" | awk -F '=' '{print $2}'`
if [ -z "$DELAY" ] ; then
@ -29,6 +30,9 @@ case "$1" in
fi
start-stop-daemon -S -q -p $PIDFILE -x $DDCLIENT -- $DELAY
log_end_msg $?
else
log_warning_msg "Service ddclient already running..."
fi
;;
stop)
if [ -f $PIDFILE ] ; then
@ -36,6 +40,8 @@ case "$1" in
start-stop-daemon -K -q -p $PIDFILE
log_end_msg $?
rm -f $PIDFILE
else
log_warning_msg "No ddclient running..."
fi
;;
restart|reload|force-reload)