tor-dam

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

dam-dir.init (769B)


      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-dir"
      6 pidfile="/var/run/dam-dir.pid"
      7 
      8 description="Tor DAM server"
      9 
     10 depend() {
     11 	after logger ntp
     12 	before tor dam-client
     13 }
     14 
     15 start() {
     16 	ebegin "Starting $description"
     17 	_h="$(getent passwd $damuid | cut -d: -f6)"
     18 	mkdir -p $(dirname $damlog)
     19 	chown $damuid:$damgid $(dirname $damlog)
     20 	supervise-daemon -d $_h -e HOME=$_h -u $damuid -g $damgid \
     21 		--pidfile $pidfile -1 $damlog -2 $damlog \
     22 		--start $command $damopts
     23 }
     24 
     25 stop() {
     26 	ebegin "Stopping $description"
     27 	ddir="$(pgrep -P $(cat $pidfile))"
     28 	rdis="$(pgrep -P $ddir)"
     29 	supervise-daemon --stop $command -p $pidfile
     30 	kill $rdis || true
     31 	kill $ddir || true
     32 }