[Slackbuilds-users] Starting a daemon in rc

phalange at komputermatrix.com phalange at komputermatrix.com
Fri Mar 10 17:11:18 UTC 2023


On 2023-03-10 10:06, Ruben Schuller wrote:
> Hi!
> 
> 2023-03-10 phalange at komputermatrix.com:
> 
>> I have slackbuild for tailscale that includes a daemon. The daemon
>> should ideally be started by the init system. But it requires an
>> internet connection, and in the case of using wifi, starting this
>> daemon from rc.local halts the init -- *I think* because it's
>> searching for a connection before wifi is connected.
>> 
>> Any suggestions for starting a daemon like this?
> 
> You could try the "daemon" package for this, it's shipped with 
> Slackware
> and works pretty well! Here's how I do it for my dendrite SlackBuild
> (not on SBo yet):
> 
> ----8<-------------------------------
> #!/bin/sh
> 
> if [ -f /etc/default/dendrite ]; then
> 	. /etc/default/dendrite
> fi
> 
> dendrite_start() {
>   if [ -x /usr/bin/dendrite-monolith-server ]; then
> 	daemon -n dendrite -u dendrite -- dendrite-monolith-server-tls-key
> $TLSKEY -tls-cert $TLSCERT -config /etc/dendrite/dendrite.yaml
>   fi
> }
> 
> dendrite_stop() {
> 	daemon -n dendrite -u dendrite --stop
> }
> 
> dendrite_restart() {
>   dendrite_stop
>   sleep 1
>   dendrite_start
> }
> 
> case "$1" in
> 'start')
>   dendrite_start
>   ;;
> 'stop')
>   dendrite_stop
>   ;;
> 'restart')
>   dendrite_restart
>   ;;
> *)
>   echo "usage $0 start|stop|restart"
> esac
> ----8<-------------------------------
> 
> I'm not sure how to handle the waiting for the network. I suppose you
> could add something which checks if network manager is connected, but
> be aware that there are people (myself included) who use the classic
> Slackware network scripts for this and it wouldn't work. Maybe you
> could add something which pings the tailscale servers, you are going
> to connect to them anyway.
> 
> Cheers
> Ruben
> _______________________________________________
> SlackBuilds-users mailing list
> SlackBuilds-users at slackbuilds.org
> https://lists.slackbuilds.org/mailman/listinfo/slackbuilds-users
> Archives - https://lists.slackbuilds.org/pipermail/slackbuilds-users/
> FAQ - https://slackbuilds.org/faq/

Thanks Ruben, I appreciate the idea. Doesn't this require the user to 
issue a command still?

-AP


More information about the SlackBuilds-users mailing list