Running a Grin++ public node (Linux)

systemd to auto start GRIN++ node.

I did write a small systemd service to auto start the GRIN++ node.

grinPP.service

[Unit]
Description=Grin node++
After=network.target

[Service]
WorkingDirectory=/opt/grin/grinPP
User=grin
Group=grin
PrivateDevices=yes
Type=simple
ExecReload="/bin/kill -HUP $MAINPID"
KillMode=mixed
KillSignal=SIGTERM
TimeoutStopSec=60
ExecStart=/opt/grin/grinPP/grin --headless > /dev/null 2>&1 &
Restart=on-failure
RestartSec=30

[Install]
WantedBy=multi-user.target
Alias=grinPP.service

adjust your WorkingDirectory and ExecStart paramentes as well as the User !

Place this file under /etc/system/system as grinPP.service.

You can now start the service using:

  • systemctl start grinPP.service

You can now stop the service using:

  • systemctl stop grinPP.service

You can now check status of this service using:

  • systemctl status grinPP.service
 grinPP.service - Grin node++
     Loaded: loaded (/etc/systemd/system/grinPP.service; disabled; vendor preset: enabled)
     Active: active (running) since Tue 2022-01-18 10:37:05 UTC; 8min ago
   Main PID: 103473 (grin)
      Tasks: 84 (limit: 4557)
     Memory: 371.1M
        CPU: 32.088s
     CGroup: /system.slice/grinPP.service
             ├─103473 /opt/grin/grinPP/grin --headless > /dev/null 2>&1 &
             └─103511 /opt/grin/grinPP/tor/tor --ControlPort 3423 --SocksPort 3422 --DataDirectory /grin/.GrinPP/MAINNET/TOR/data3423 --HashedControlPassword 16:906248AB51F939ED605CE9937D3B1FDE65DEB4098A889B2A07AC221D8F -f /grin/.>

Jan 18 10:40:23 grinpp01.grinnode.live grin[103511]: Jan 18 10:40:23.000 [notice] Heartbeat: Tor's uptime is 0:03 hours, with 9 circuits open. I've sent 488 kB and received 4.74 MB.
Jan 18 10:40:53 grinpp01.grinnode.live grin[103511]: Jan 18 10:40:53.000 [notice] Heartbeat: Tor's uptime is 0:03 hours, with 8 circuits open. I've sent 498 kB and received 4.75 MB.
Jan 18 10:41:23 grinpp01.grinnode.live grin[103511]: Jan 18 10:41:23.000 [notice] Heartbeat: Tor's uptime is 0:04 hours, with 8 circuits open. I've sent 505 kB and received 4.75 MB.
Jan 18 10:41:53 grinpp01.grinnode.live grin[103511]: Jan 18 10:41:53.000 [notice] Heartbeat: Tor's uptime is 0:04 hours, with 10 circuits open. I've sent 511 kB and received 4.76 MB.

To enable this service at reboot:

  • systemctl enable grinPP.service
3 Likes