Skip to content

Commit c1e921d

Browse files
authored
systemd service unit example (#257)
* systemd service unit example * typo * inconsistent use of sudo
1 parent 88eb1fc commit c1e921d

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

scripts/systemd/nym-mixnode.service

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# This is an example systemd service unit illustrating how to make a mixnode
2+
# start and stop automatically on a Linux box which runs on systemd.
3+
# To determine if it is applicable to your system simply run "ps 1". If the
4+
# output mentions "systemd" then you're good to go.
5+
#
6+
# Systemd has pretty sophisticated features to tweak the service runtime
7+
# behavior. If you want to explore them you can start with the official docs:
8+
# https://www.freedesktop.org/software/systemd/man/systemd.service.html
9+
# https://www.freedesktop.org/software/systemd/man/systemd.exec.html
10+
# However keep in mind that more often than not the defaults work very well.
11+
#
12+
# Directions of use (description and example command)
13+
# 1. Create a "nym" user and group (example for Debian):
14+
# sudo useradd -U -m -s /sbin/nologin nym
15+
# 2. Start a new bash session with your nym user:
16+
# sudo -u nym bash
17+
# 3. Change to the users home directory:
18+
# cd
19+
# 4. Obtain the current mixnode binary from the nym release page and make it
20+
# executable:
21+
# curl -LO https://github.com/nymtech/nym/releases/download/v0.7.0/nym-mixnode_linux_x86_64
22+
# chmod 755 nym-mixnode_linux_x86_64
23+
# 6. Initialize the mixnode config (this assumes a simple IPv4 setup):
24+
# ./nym-mixnode_linux_x86_64 init --id iamboss -layer 2 --host $(curl -sS v4.icanhazip.com)
25+
# 7. Give it a try. The mixnode should run in the foreground until you
26+
# terminate it with Ctrl-C:
27+
# ./nym-mixnode_linux_x86_64 run --id iamboss
28+
# 8. Exit from your nym shell:
29+
# exit
30+
# 9. Copy this file over to /etc/systemd/system/nym-mixnode.service.
31+
# 4. Enable the service so that it will autostart at boot-time:
32+
# sudo systemctl enable nym-mixnode
33+
# 3. Start the nym service:
34+
# sudo systemctl start nym-mixnode
35+
36+
[Unit]
37+
Description=nym mixnode service
38+
After=network.target
39+
40+
[Service]
41+
Type=simple
42+
User=nym
43+
Group=nym
44+
WorkingDirectory=/home/nym
45+
ExecStart=/home/nym/nym-mixnode_linux_x86_64 run --id iamboss
46+
Restart=on-abort
47+
48+
[Install]
49+
WantedBy=multi-user.target

0 commit comments

Comments
 (0)