TiddlyWikiSystemd

14th February 2017 at 10:50pm
RH299CourseNotes TechnicalNotes TiddlyWiki TiddlyWikiApacheProxy

Node.js Systemd Service

root@fooserver:# cat > /etc/systemd/system/tw5-foosite.service <<EOF 
[Unit]
Description=Foo Site TiddlyWiki
#Requires=Before=apache2.service       # Required to run before the apache2 service

[Service]
ExecStart=/usr/local/bin/tiddlywiki /srv/tw5-foosite --server
Restart=always
RestartSec=10                       # Restart service after 10 seconds if node service crashes
StandardOutput=syslog               # Output to syslog
StandardError=syslog                # Output to syslog
SyslogIdentifier=tw5-foosite
User=tw5-foosite
Group=tw5-foosite
Environment=NODE_ENV=production PORT=9251

[Install]
WantedBy=multi-user.target
EOF
  • systemctl enable tw5-foosite.service
  • systemctl start tw5-foosite.service
  • systemctl status tw5-foosite.service
  • systemctl daemon-reload
  • systemctl restart tw5-foosite.service