updated init script
This commit is contained in:
parent
d8c96aad74
commit
f1b47589e6
2 changed files with 22 additions and 3 deletions
|
@ -31,9 +31,6 @@ mkdir -p /opt/mailtrain
|
|||
cd /opt/mailtrain
|
||||
git clone git://github.com/andris9/mailtrain.git .
|
||||
|
||||
# Set up upstart service script
|
||||
cp setup/mailtrain.conf /etc/init
|
||||
|
||||
# Add new user for the daemon to run as
|
||||
useradd mailtrain || true
|
||||
|
||||
|
@ -71,6 +68,15 @@ cat <<EOM > /etc/logrotate.d/mailtrain
|
|||
}
|
||||
EOM
|
||||
|
||||
if [ -d "/usr/lib/systemd" ]; then
|
||||
# Set up systemd service script
|
||||
cp setup/mailtrain.service /etc/systemd/system/
|
||||
systemctl enable mailtrain.service
|
||||
else
|
||||
# Set up upstart service script
|
||||
cp setup/mailtrain.conf /etc/init/
|
||||
fi
|
||||
|
||||
# Start the service
|
||||
service mailtrain start
|
||||
|
||||
|
|
13
setup/mailtrain.service
Normal file
13
setup/mailtrain.service
Normal file
|
@ -0,0 +1,13 @@
|
|||
Description=Mailtrain server
|
||||
Requires=After=mysql.service
|
||||
|
||||
[Service]
|
||||
Environment="NODE_ENV=production"
|
||||
WorkingDirectory=/opt/mailtrain
|
||||
ExecStart=/usr/bin/node index.js >> /var/log/mailtrain.log 2>&1
|
||||
Type=simple
|
||||
Restart=always
|
||||
RestartSec=10
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
Loading…
Add table
Add a link
Reference in a new issue