[Samba] After upgrading samba 4.5.10 to 4.9.13

Rowland penny rpenny at samba.org
Sun Oct 13 15:03:11 UTC 2019


On 13/10/2019 15:06, Дмитрий Милькин wrote:
> #!/sbin/openrc-run

Never used openrc :-(


> # Copyright 1999-2018 Gentoo Foundation
> # Distributed under the terms of the GNU General Public License, v2 or 
> later
>
> extra_started_commands="reload"
> [ -z "${piddir}" ] && piddir="/run/samba"
>
> depend() {
>         after slapd
>         need net
>         use cupsd
> }
>
I take it that 'depend' means the services listed must be running, if 
so, then there is a problem right there. You cannot run slapd and a 
Samba AD DC on the same computer (unless slapd is not running on ports 
389 and 636)
> DAEMONNAME="${SVCNAME##samba.}"
> [ "${DAEMONNAME}" != "samba" ] && daemon_list=${DAEMONNAME}
I 'think' this picks up the 'daemon_list' from '/etc/conf.d/samba' and 
uses that if it isn't 'samba', problem is that it isn't 'samba' and 
there isn't a daemon called 'samba4'
>
> signal_do() {
>         local signal="$1"
>         [ -z "${signal}" ] && return 0
>
>         local result=0 last_result=0 daemon= cmd_exec=
>         for daemon in ${daemon_list} ; do
>                 eval cmd_exec=\$${daemon}_${signal}
>                 if [ -n "${cmd_exec}" ]; then
>                         ebegin "${my_service_name} -> ${signal}: 
> ${daemon}"
>                         #echo ${cmd} '->' ${!cmd}
>                         ${cmd_exec} > /dev/null
>                         last_result=$?
>                         eend ${last_result}
>                 fi
>                 result=$(( ${result} + ${last_result} ))
>         done
>         return ${result}
> }
>
> start() {
>         ${my_service_PRE}
>         [ -d "${piddir}" ] || mkdir -p "${piddir}"
>         signal_do start && return 0
>
>         eerror "Error: starting services (see system logs)"
>         signal_do stop
>         return 1
> }
> stop() {
>         ${my_service_PRE}
>         if signal_do stop ; then
>                 ${my_service_POST}
>                 return 0
>         fi
> }
> reload() {
>         ${my_service_PRE}
>         signal_do reload
> }
>
>
All of the above is guess work and could be way off the mark, but I did 
some googling and came up with this:

#!/sbin/openrc-run

extra_started_commands="reload"

SERVER_ROLE=`samba-tool testparm --parameter-name="server role" 
2>/dev/null | tail -1`
if [ "$SERVER_ROLE" != "active directory domain controller" ]; then
     exit 1
fi

depend() {
         need net
         after firewall
}

start() {
         ebegin "Starting samba"
         mkdir -p /var/run/samba
         start-stop-daemon --start --quiet --exec /usr/sbin/samba --
         eend $?
}

stop() {
         ebegin "Stopping samba"
         start-stop-daemon --stop --quiet --pidfile /var/run/samba/samba.pid
         eend $?
}

reload() {
           ebegin "Reloading samba"
           killall -HUP samba
           eend $?
}

Can you try this.

If it doesn't work, I think you either need an openrc expert or to talk 
to Gentoo.

Rowland





More information about the samba mailing list