tor-dam

tor distributed announce mechanism (not a dht)
git clone https://git.parazyd.org/tor-dam
Log | Files | Refs | README | LICENSE

dam-client.init (757B)


      1 #!/sbin/openrc-run
      2 # Copyright 1999-2018 Gentoo Foundation
      3 # Distributed under the terms of the GNU General Public License v2
      4 
      5 command="/home/$damuid/go/bin/dam-client"
      6 pidfile="/var/run/dam-client.pid"
      7 
      8 description="Tor DAM client"
      9 
     10 depend() {
     11 	after tor dam-dir ntp
     12 }
     13 
     14 start() {
     15 	ebegin "Starting $description"
     16 	_h="$(getent passwd $damuid | cut -d: -f6)"
     17 	mkdir -p $(dirname $damlog)
     18 	chown $damuid:$damgid $(dirname $damlog)
     19 	supervise-daemon -d $_h -e HOME=$_h -u $damuid -g $damgid \
     20 		--pidfile $pidfile -1 $damlog -2 $damlog \
     21 		--start $command $damopts
     22 }
     23 
     24 stop() {
     25 	ebegin "Stopping $description"
     26 	dcli="$(pgrep -P $(cat $pidfile))"
     27 	dahs="$(pgrep -P $dcli)"
     28 	supervise-daemon --stop $command -p $pidfile
     29 	kill $dahs || true
     30 	kill $dcli || true
     31 }