Last active
August 15, 2017 19:37
-
-
Save ironman9967/fcf0a553edab345597aee8c83b1746e3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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