Skip to content

Instantly share code, notes, and snippets.

@ironman9967
Last active August 15, 2017 19:37
Show Gist options
  • Save ironman9967/fcf0a553edab345597aee8c83b1746e3 to your computer and use it in GitHub Desktop.
Save ironman9967/fcf0a553edab345597aee8c83b1746e3 to your computer and use it in GitHub Desktop.
chmod +x dist/index.js
cmd="[Unit]\n" \
"Description=[service]\n" \
"After=network.target\n" \
"\n" \
"[Service]\n" \
"ExecStart=/home/ubuntu/[user]/dist/index.js\n" \
"Restart=always\n" \
"User=myUser\n" \
"Environment=PATH=/usr/bin:/usr/local/bin\n" \
"WorkingDirectory=/home/ubuntu/[user]\n" \
"\n" \
"[Install]\nWantedBy=multi-user.target\n"
echo -e $cmd | sudo tee /etc/systemd/system/[app].service
sudo systemctl enable [service]
sudo systemctl start [service]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment