Skip to content

Instantly share code, notes, and snippets.

@akostadinov
Created January 6, 2018 15:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save akostadinov/018ae2f2d2db5317a43386c73a28aed0 to your computer and use it in GitHub Desktop.
Save akostadinov/018ae2f2d2db5317a43386c73a28aed0 to your computer and use it in GitHub Desktop.
StorJ sharing node systemd init service file
# # useradd storj
# $ install storj node as user as described in
# https://docs.storj.io/v1.1/docs/setting-up-storj-share-on-a-raspberry-pi
# * use chrony instead of ntpd (non mandatory but it is better)
# * use instructions up to start-farming.sh
# $ write this file as ~/.config/systemd/user/storj.service
# # loginctl enable-linger myuser
# # reboot
# # su - myuser
# XDG needed for https://bugzilla.redhat.com/show_bug.cgi?id=1531890
# $ export XDG_RUNTIME_DIR=/run/user/`id -u`
# $ systemctl --user enable storj
# You can add/remove nodes at any time while storj daemon is running via the
# `storjshare` command. The key thing is to run `storjshare save` when you do
# any changes. The service will run `storjshare load` so whatever changes you
# do will be applied on startup.
# Service does not track individual nodes because they are restarted
# automatically by the daemon. I tried by killing one. Now if daemon just hangs
# that is another story. For extra security you can regularly check status of
# each node.
[Unit]
Description=StorJ sharing
After=syslog.target network.target
[Service]
# WorkingDirectory=/home/storj
# Environment=TEST=foo
ExecStart=/bin/bash -l -c "exec storjshare daemon -F"
ExecStartPost=/bin/bash -l -c "for i in `seq 5`; do sleep 5; storjshare status && break; done && storjshare load"
ExecStop=/bin/bash -l -c "storjshare killall"
Restart=always
PrivateTmp=true
NoNewPrivileges=true
[Install]
WantedBy=default.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment