Skip to content

Instantly share code, notes, and snippets.

@TakashiSasaki
Last active November 22, 2018 00:22
Show Gist options
  • Save TakashiSasaki/9663ee066daeddd10d562f099ec624da to your computer and use it in GitHub Desktop.
Save TakashiSasaki/9663ee066daeddd10d562f099ec624da to your computer and use it in GitHub Desktop.
systemd and init.d script for dhtnode on my Raspbery Pi
/etc/systemd/
#!/bin/sh
case $1 in
start)
start-stop-daemon --exec /usr/local/bin/dhtnode -n dhtnode --start -- -d -p 4222 -b bootstrap.ring.cx -v -l /var/log/dhtnode
;;
stop)
start-stop-daemon -n dhtnode --stop
;;
esac
.PHONY: help clean install start restart stop killall
check:
-sudo systemctl -a | grep opendht
ps aux | grep dhtnode
clean: killall
rm -f /etc/systemd/system/opendht.service
opendht.service.old:
-cp /etc/systemd/system/opendht.service opendht.service.old
install: opendht.service.old killall
sudo cp opendht.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo tail /var/log/syslog
-sudo systemctl -a | grep opendht
start: killall
sudo service opendht start
sudo tail /var/log/syslog
ps aux | grep dhtnode
restart:
sudo service opendht restart
sudo tail /var/log/syslog
ps aux | grep dhtnode
stop:
-sudo service opendht stop
sudo tail /var/log/syslog
ps aux | grep dhtnode
killall: stop
-sudo killall dhtnode
sudo tail /var/log/syslog
ps aux | grep dhtnode
[Unit]
After=network.target auditd.service
Description=OpenDHT standalone node
[Service]
DynamicUser=yes
#EnvironmentFile=/etc/opendht/dhtnode.conf
ExecStart=/usr/local/bin/dhtnode -v -d -l /var/log/dhtnode.log -b bootstrap.ring.cx -p 4222
KillMode=process
Restart=on-failure
Type=forking
[Install]
Alias=dhtnode.service
WantedBy=multi-user.target
[Unit]
Description=OpenDHT
After=network.target auditd.service
ConditionPathExists=!/etc/ssh/sshd_not_to_be_run
[Service]
ExecStart=/usr/local/bin/dhtnode
KillMode=process
Restart=always
Type=notify
[Install]
Alias=dhtnode.service
/usr/lib/systemd/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment