The officially official Devuan Forum!

You are not logged in.

#1 2022-10-24 20:45:01

nahkhiirmees
Member
Registered: 2022-07-24
Posts: 186  

init script for stubby

Couple months ago i tried dnsmasq and stubby. During that time i noticed that there's no init script for stubby so i wrote one:

#!/bin/sh

### BEGIN INIT INFO
# Provides: stubby
# Required-Start: $network $remote_fs $syslog
# Required-Stop:  $network $remote_fs $syslog
# Default-Start:  2 3 4 5
# Default-Stop:   0 1 6
# Description: a dns resolver
### END INIT INFO

#. /lib/lsb/init-functions

case "$1" in
  start)
	touch /run/stubby.pid
	chmod 600 /run/stubby.pid
	chown stubby:65534 /run/stubby.pid
	sudo -u stubby stubby -g
	;;
 stop)
	killall stubby
        ;;
  *)
        echo "Usage: $SCRIPTNAME start" >&2
        exit 3
        ;;
esac

pretty obvious stuff. The #BEGIN ... #END - parts i copied from dnsmasq's init file or some other file and changed a few rows.
How about adding something like this in the stubby package?

Offline

#2 2022-10-24 20:54:14

Head_on_a_Stick
Member
From: London
Registered: 2019-03-24
Posts: 3,125  
Website

Re: init script for stubby

sudo shouldn't be used in init scripts. There are other issues.

For a better version (along with postinst, prerm & postrm scripts) see https://bugs.debian.org/cgi-bin/bugrepo … ug=1008931.

Related: https://dev1galaxy.org/viewtopic.php?id=4865 ← that shows how to generate an init script from the supplied /lib/systemd/system/stubby.service unit file.


Brianna Ghey — Rest In Power

Offline

Board footer