Skip to content

Commit 7d801e7

Browse files
committed
Created systemd run script for application.
1 parent 9804a6a commit 7d801e7

3 files changed

Lines changed: 42 additions & 1 deletion

File tree

gitGraph.service

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# File Location /lib/systemd/system
2+
#
3+
# After file creation run: systemctl daemon-reload
4+
# enable service on start up: systemctl enable jeff
5+
# start the service: systemctl start jrtechs
6+
7+
8+
[Unit]
9+
Description=Node app for github app
10+
Documentation=https://jrtechs.net
11+
After=network.target
12+
13+
[Service]
14+
Type=simple
15+
User=jeff
16+
WorkingDirectory=/var/www/github-graphs.com/github-graphs
17+
ExecStart=/var/www/github-graphs.com/github-graphs/run.sh
18+
Restart=on-failure
19+
20+
[Install]
21+
WantedBy=multi-user.target

routes/api.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@ routes.get('/*', (request, result) =>
6666
{
6767
result.write(JSON.stringify(data));
6868
}
69+
else
70+
{
71+
result.write("[]");
72+
}
6973
result.end();
7074
}).catch(function(error)
7175
{
@@ -75,8 +79,15 @@ routes.get('/*', (request, result) =>
7579
{
7680
result.write(JSON.stringify(error));
7781
}
82+
else
83+
{
84+
result.write("[]");
85+
}
86+
7887
}
79-
catch(error) {};
88+
catch(error) {
89+
result.write("[]");
90+
};
8091
result.end();
8192
});
8293

run.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
# run - this script enters a infinite loop to ensure that the website does not go down if it
3+
# hits any unexpected error that crashes Nodejs
4+
#
5+
# 2/13/18 Jeffery Russell
6+
7+
while true
8+
do node server.js
9+
done

0 commit comments

Comments
 (0)