Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
ddclient not working via init script
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
Rocky007
n00b
n00b


Joined: 22 Dec 2014
Posts: 66

PostPosted: Fri Jun 30, 2017 12:50 pm    Post subject: ddclient not working via init script Reply with quote

Hello,

i'm trying to use ddclient to update my ip to strato.
When starting via

Code:
ddclient -daemon=0 -debug -verbose -noquiet


it says success...

When starting via

Code:
/etc/init.d/ddclient start


it gives me the following

Code:

SGC ~ # /etc/init.d/ddclient restart
 * Caching service dependencies ...                                                                                                                                                        [ ok ]
find: invalid mode '+0044'
 * Starting ddclient ...
WARNING:  file /etc/ddclient/ddclient.conf: Cannot open file '/etc/ddclient/ddclient.conf'. (Permission denied)
stat() on closed filehandle FD at /usr/sbin/ddclient line 986.
Use of uninitialized value $mode in bitwise and (&) at /usr/sbin/ddclient line 987.
readline() on closed filehandle FD at /usr/sbin/ddclient line 999.
WARNING:  file /etc/ddclient/ddclient.conf: Cannot open file '/etc/ddclient/ddclient.conf'. (Permission denied)
stat() on closed filehandle FD at /usr/sbin/ddclient line 986.
Use of uninitialized value $mode in bitwise and (&) at /usr/sbin/ddclient line 987.
readline() on closed filehandle FD at /usr/sbin/ddclient line 999.
WARNING:  file /var/cache/ddclient/ddclient.cache: Cannot open file '/var/cache/ddclient/ddclient.cache'. (Permission denied)
stat() on closed filehandle FD at /usr/sbin/ddclient line 986.
Use of uninitialized value $mode in bitwise and (&) at /usr/sbin/ddclient line 987.
readline() on closed filehandle FD at /usr/sbin/ddclient line 999.
 * start-stop-daemon: failed to start `/usr/sbin/ddclient'                                                                                                                                 [ !! ]
 * ERROR: ddclient failed to start


Whats going wrong here?

I need to set it up as a service starting on boot
Back to top
View user's profile Send private message
xaviermiller
Bodhisattva
Bodhisattva


Joined: 23 Jul 2004
Posts: 8708
Location: ~Brussels - Belgique

PostPosted: Fri Jun 30, 2017 12:59 pm    Post subject: Reply with quote

Hi!

Can you take a look at the init script which user is used?
That user need read rights to the configuration file, and write rights for the log and pid files
_________________
Kind regards,
Xavier Miller
Back to top
View user's profile Send private message
Rocky007
n00b
n00b


Joined: 22 Dec 2014
Posts: 66

PostPosted: Fri Jun 30, 2017 1:06 pm    Post subject: Reply with quote

Code:
#!/sbin/openrc-run
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

if [ -d /run ] ; then
        PIDFILE=${PIDFILE:-/run/ddclient/ddclient.pid}
else
        PIDFILE=${PIDFILE:-/var/run/ddclient/ddclient.pid}
fi

depend() {
        before cron
        need net
        use dns logger squid
}

checkconfig() {
        local conf="/etc/ddclient/ddclient.conf"

        if [ -e "${conf}" ] ; then
                if [ -n "$(find /etc/ddclient -maxdepth 1 -name ddclient.conf -perm +0044)" ] ; then
                        eerror "${conf} must not be world or group readable. Try:"
                        eerror "    chmod 600 ${conf}"
                        eerror "    chown ddclient:ddclient ${conf}"
                        return 1
                fi
        else
                eerror "${conf} is needed to run ddclient"
                eerror "There is a sample file in /etc/ddclient/"
                return 1
        fi
}

start() {
        checkconfig || return 1

        local piddir=$(dirname ${PIDFILE})
        if [ ! -d ${piddir} ] ; then
                ebegin "Making ${piddir}"
                mkdir -p ${piddir}
                eend $?
                ebegin "Changing permissions of ${piddir}"
                chown ddclient:ddclient ${piddir}
                eend $?
        fi
        ebegin "Starting ${SVCNAME}"
        start-stop-daemon --start --user ddclient --exec /usr/sbin/ddclient \
                --name ddclient --pidfile ${PIDFILE} -- -pid=${PIDFILE}
        eend $?
}

stop() {
        ebegin "Stopping ${SVCNAME}"
        start-stop-daemon --stop --signal USR1 --pidfile ${PIDFILE}
        eend $?
}


I've chown the following to ddclient:ddclient

/etc/ddclient (folder)
/etc/ddclient/ddclient.conf (file)
/var/cache/ddclient (folder)
/var/cache/ddcleint/ddclient.cache (file)

now it gives me

Code:

SGC ddclient # /etc/init.d/ddclient restart
 * Stopping ddclient ...                                                                                                                                                                   [ ok ]
find: invalid mode '+0044'
 * Starting ddclient ...
Use of uninitialized value in string ne at /usr/sbin/ddclient line 2335.                                                                                                                   [ ok ]
SGC ddclient # /etc/init.d/ddclient status
 * status: crashed
Back to top
View user's profile Send private message
ronaldoc
n00b
n00b


Joined: 03 Jul 2017
Posts: 15

PostPosted: Wed Jul 05, 2017 9:14 am    Post subject: Reply with quote

Hmm, how do we check if the user has read rights to the configuration file?
Back to top
View user's profile Send private message
szatox
Advocate
Advocate


Joined: 27 Aug 2013
Posts: 3136

PostPosted: Thu Jul 06, 2017 8:03 pm    Post subject: Reply with quote

ls -l will print the owner and group of a file together with permissions as a set of flags (Read,Write,eXecute) for owner, followed by group and others.
Creating a new file requires write access to its parent directory.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum