mirror of
https://github.com/motioneye-project/motioneyeos.git
synced 2025-07-28 21:56:31 +00:00
inadyn: fix init script and default config file
This commit does a number of fixes to the inadyn package to make it work properly "out of the box": * inadyn is installed in /usr/sbin, not /usr/bin, so we fix the path in the init script * Use "printf" for the Starting and Stopping messages, so that the OK / FAIL stay on the same line. * Pass the -q option to the start sequence, since it's passed in the stop sequence. * Fix the configuration file to use an existing dyndns_system and avoid a failure at startup. * Use a variable called ENABLED in /etc/default/inadyn to decide whether to start the service or not. By default, it is not started, as suggested by Gustavo, and an explicit ENABLED="yes" is needed. * Store the PID file in /var/run/inadyn.pid, like we do for all other daemons. [Thomas: drop silly comment about uncommenting the alias line in the configuration file, which is already uncommented. Noticed by Yann.] Cc: Alex Suykov <alex.suykov@gmail.com> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Reviewed-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
This commit is contained in:
parent
5f7411e171
commit
60be5da7c9
@ -4,25 +4,33 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
CONFIG=/etc/inadyn.conf
|
CONFIG=/etc/inadyn.conf
|
||||||
VR_INADYN=/var/run/inadyn
|
|
||||||
|
|
||||||
# check if CONFIG exists, print message & exit if it doesn't
|
# check if CONFIG exists, print message & exit if it doesn't
|
||||||
[ ! -f $CONFIG ] && ( echo "The config file "$CONFIG" is missing...exiting now." && exit 2 )
|
[ ! -f $CONFIG ] && ( echo "The config file "$CONFIG" is missing...exiting now." && exit 2 )
|
||||||
|
|
||||||
# check if VR_INADYN exists, create it if not
|
# Allow a few customizations from a config file. Especially inadyn
|
||||||
[ ! -d $VR_INADYN ] && mkdir -p $VR_INADYN
|
# must be explicitly enabled by adding ENABLED="yes" in this file.
|
||||||
|
test -r /etc/default/inadyn && . /etc/default/inadyn
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
start)
|
start)
|
||||||
echo "Starting inadyn: "
|
printf "Starting inadyn: "
|
||||||
start-stop-daemon -S -x /usr/bin/inadyn
|
if test "${ENABLED}" != "yes" ; then
|
||||||
|
echo "SKIPPED"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
start-stop-daemon -b -q -S -p /var/run/inadyn.pid -x /usr/sbin/inadyn
|
||||||
[ $? = 0 ] && echo "OK" || echo "FAIL"
|
[ $? = 0 ] && echo "OK" || echo "FAIL"
|
||||||
;;
|
;;
|
||||||
stop)
|
stop)
|
||||||
echo "Stopping inadyn: "
|
printf "Stopping inadyn: "
|
||||||
start-stop-daemon -q -K -x /usr/bin/inadyn
|
if test "${ENABLED}" != "yes" ; then
|
||||||
|
echo "SKIPPED"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
start-stop-daemon -q -K -p /var/run/inadyn.pid -x /usr/sbin/inadyn
|
||||||
[ $? = 0 ] && echo "OK" || echo "FAIL"
|
[ $? = 0 ] && echo "OK" || echo "FAIL"
|
||||||
rm -f /var/run/inadyn/inadyn.pid
|
rm -f /var/run/inadyn.pid
|
||||||
;;
|
;;
|
||||||
restart)
|
restart)
|
||||||
"$0" stop
|
"$0" stop
|
||||||
|
@ -1,12 +1,11 @@
|
|||||||
# Basic configuration file for inadyn
|
# Basic configuration file for inadyn
|
||||||
#
|
#
|
||||||
# /etc/inadyn.conf
|
# /etc/inadyn.conf
|
||||||
background
|
pidfile /var/run/inadyn.pid
|
||||||
update_period_sec 600 # Check for a new IP every 600 seconds
|
update_period_sec 600 # Check for a new IP every 600 seconds
|
||||||
username test # replace 'test' with your username
|
username test # replace 'test' with your username
|
||||||
password test # replace 'test' with your password
|
password test # replace 'test' with your password
|
||||||
dyndns_system dyndns@dyndns.org # replace w/ your provider
|
dyndns_system default@dyndns.org # replace w/ your provider
|
||||||
|
|
||||||
# uncomment the alias statement below to test it on your system
|
|
||||||
alias test.homeip.net
|
alias test.homeip.net
|
||||||
# replace 'test.homeip.net' with yourdomainname for actual (non-test) use
|
# replace 'test.homeip.net' with yourdomainname for actual (non-test) use
|
||||||
|
Loading…
x
Reference in New Issue
Block a user