Browse Source

Created systemd run script for application.

pull/11/head
Jeffery Russell 5 years ago
parent
commit
7d801e7ca6
3 changed files with 42 additions and 1 deletions
  1. +21
    -0
      gitGraph.service
  2. +12
    -1
      routes/api.js
  3. +9
    -0
      run.sh

+ 21
- 0
gitGraph.service View File

@ -0,0 +1,21 @@
# File Location /lib/systemd/system
#
# After file creation run: systemctl daemon-reload
# enable service on start up: systemctl enable jeff
# start the service: systemctl start jrtechs
[Unit]
Description=Node app for github app
Documentation=https://jrtechs.net
After=network.target
[Service]
Type=simple
User=jeff
WorkingDirectory=/var/www/github-graphs.com/github-graphs
ExecStart=/var/www/github-graphs.com/github-graphs/run.sh
Restart=on-failure
[Install]
WantedBy=multi-user.target

+ 12
- 1
routes/api.js View File

@ -66,6 +66,10 @@ routes.get('/*', (request, result) =>
{
result.write(JSON.stringify(data));
}
else
{
result.write("[]");
}
result.end();
}).catch(function(error)
{
@ -75,8 +79,15 @@ routes.get('/*', (request, result) =>
{
result.write(JSON.stringify(error));
}
else
{
result.write("[]");
}
}
catch(error) {};
catch(error) {
result.write("[]");
};
result.end();
});

+ 9
- 0
run.sh View File

@ -0,0 +1,9 @@
#!/bin/bash
# run - this script enters a infinite loop to ensure that the website does not go down if it
# hits any unexpected error that crashes Nodejs
#
# 2/13/18 Jeffery Russell
while true
do node server.js
done

Loading…
Cancel
Save