blob: 549230beb11a01466b2f865e73d66eec5caf4625 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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
|