diff options
author | neodarz <neodarz@neodarz.net> | 2017-08-02 01:13:11 +0200 |
---|---|---|
committer | neodarz <neodarz@neodarz.net> | 2017-08-02 01:13:11 +0200 |
commit | b2653d82830b90512206d5ef7e2973af18e2400d (patch) | |
tree | 29aac8318b6a2cd706c235abbf91126e4060c242 /create_service.sh | |
download | kresus-gen-b2653d82830b90512206d5ef7e2973af18e2400d.tar.xz kresus-gen-b2653d82830b90512206d5ef7e2973af18e2400d.zip |
initial commit
Diffstat (limited to '')
-rwxr-xr-x | create_service.sh | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/create_service.sh b/create_service.sh new file mode 100755 index 0000000..549230b --- /dev/null +++ b/create_service.sh @@ -0,0 +1,40 @@ +usage () { + echo "You must set a $1 !" + echo "Usage:" + echo " create-service.sh <user>" + exit 0 +} + +if [ -z $1 ]; then + usage "USER" +fi + + +USER=$1 +NODE_PATH=$(which node) + +sudo bash -c "cat << EOF > /etc/systemd/system/kresus-$USER.service +[Unit] +Description=Personal finance manager +After=network.target + +[Service] +WorkingDirectory=/home/website/kresus-gen/$USER.kresus.neodarz.net +Environment=NODE_ENV=production +ExecStart=$NODE_PATH bin/kresus.js + +Type=simple +#Restart=always + +User=neodarz + +StandardOutput=journal +StandardError=inherit +SyslogIdentifier=kresus + +[Install] +WantedBy=multi-user.target +EOF" + +sudo systemctl enable kresus-$USER.service +sudo systemctl start kresus-$USER.service |