Last active
November 22, 2018 00:22
-
-
Save TakashiSasaki/9663ee066daeddd10d562f099ec624da to your computer and use it in GitHub Desktop.
systemd and init.d script for dhtnode on my Raspbery Pi
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*.swp |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/etc/systemd/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[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 | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[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 | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/usr/lib/systemd/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment