<div dir="auto"><div><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Mar 10, 2023, 9:11 AM  <<a href="mailto:phalange@komputermatrix.com">phalange@komputermatrix.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 2023-03-10 10:06, Ruben Schuller wrote:<br>
> Hi!<br>
> <br>
> 2023-03-10 <a href="mailto:phalange@komputermatrix.com" target="_blank" rel="noreferrer">phalange@komputermatrix.com</a>:<br>
> <br>
>> I have slackbuild for tailscale that includes a daemon. The daemon<br>
>> should ideally be started by the init system. But it requires an<br>
>> internet connection, and in the case of using wifi, starting this<br>
>> daemon from rc.local halts the init -- *I think* because it's<br>
>> searching for a connection before wifi is connected.<br>
>> <br>
>> Any suggestions for starting a daemon like this?<br>
> <br>
> You could try the "daemon" package for this, it's shipped with <br>
> Slackware<br>
> and works pretty well! Here's how I do it for my dendrite SlackBuild<br>
> (not on SBo yet):<br>
> <br>
> ----8<-------------------------------<br>
> #!/bin/sh<br>
> <br>
> if [ -f /etc/default/dendrite ]; then<br>
>       . /etc/default/dendrite<br>
> fi<br>
> <br>
> dendrite_start() {<br>
>   if [ -x /usr/bin/dendrite-monolith-server ]; then<br>
>       daemon -n dendrite -u dendrite -- dendrite-monolith-server-tls-key<br>
> $TLSKEY -tls-cert $TLSCERT -config /etc/dendrite/dendrite.yaml<br>
>   fi<br>
> }<br>
> <br>
> dendrite_stop() {<br>
>       daemon -n dendrite -u dendrite --stop<br>
> }<br>
> <br>
> dendrite_restart() {<br>
>   dendrite_stop<br>
>   sleep 1<br>
>   dendrite_start<br>
> }<br>
> <br>
> case "$1" in<br>
> 'start')<br>
>   dendrite_start<br>
>   ;;<br>
> 'stop')<br>
>   dendrite_stop<br>
>   ;;<br>
> 'restart')<br>
>   dendrite_restart<br>
>   ;;<br>
> *)<br>
>   echo "usage $0 start|stop|restart"<br>
> esac<br>
> ----8<-------------------------------<br>
> <br>
> I'm not sure how to handle the waiting for the network. I suppose you<br>
> could add something which checks if network manager is connected, but<br>
> be aware that there are people (myself included) who use the classic<br>
> Slackware network scripts for this and it wouldn't work. Maybe you<br>
> could add something which pings the tailscale servers, you are going<br>
> to connect to them anyway.<br>
> <br>
> Cheers<br>
> Ruben<br>
> _______________________________________________<br>
> SlackBuilds-users mailing list<br>
> <a href="mailto:SlackBuilds-users@slackbuilds.org" target="_blank" rel="noreferrer">SlackBuilds-users@slackbuilds.org</a><br>
> <a href="https://lists.slackbuilds.org/mailman/listinfo/slackbuilds-users" rel="noreferrer noreferrer" target="_blank">https://lists.slackbuilds.org/mailman/listinfo/slackbuilds-users</a><br>
> Archives - <a href="https://lists.slackbuilds.org/pipermail/slackbuilds-users/" rel="noreferrer noreferrer" target="_blank">https://lists.slackbuilds.org/pipermail/slackbuilds-users/</a><br>
> FAQ - <a href="https://slackbuilds.org/faq/" rel="noreferrer noreferrer" target="_blank">https://slackbuilds.org/faq/</a><br>
<br>
Thanks Ruben, I appreciate the idea. Doesn't this require the user to <br>
issue a command still?<br>
<br>
-AP<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">Personally, I'd just make a note of it in the README.</div><div dir="auto"><br></div><div dir="auto">For people using Slackware's networking scripts, you could just add a simple command to rc.local.</div><div dir="auto"><br></div><div dir="auto">if [ -x /etc/rc.d/rc.tailscale ]; then</div><div dir="auto">  /etc/rc.d/rc.tailscale start</div><div dir="auto">fi</div><div dir="auto"><br></div><div dir="auto">For people using NetworkManager, they could add a script (maybe 00-tailscale.sh) to /etc/NetworkManager/dispatcher.d/ containing something like:</div><div dir="auto"><br></div><div dir="auto"><div dir="auto">if [ "$2" = "up" ]; then</div><div dir="auto">  if [ -x /etc/rc.d/rc.tailscale ]; then</div><div dir="auto">    /etc/rc.d/rc.tailscale start</div><div dir="auto">  fi</div><div dir="auto">fi</div><div dir="auto"><br></div><div dir="auto">I don't use NetworkManager, but I believe that is the correct format.</div><div dir="auto"><br></div><div dir="auto">Jeremy</div></div></div>