Set post-install in package.json to cp upstart script to /etc/init
npm start will launch shovel service
This commit is contained in:
parent
469dc2a524
commit
b94b47a144
@ -16,5 +16,9 @@
|
||||
"devDependencies": {
|
||||
"should": "~7.0.1",
|
||||
"supertest": "~1.0.1"
|
||||
},
|
||||
"scripts" :{
|
||||
"postinstall": "scripts/post-install.sh",
|
||||
"start" : "start shovel"
|
||||
}
|
||||
}
|
||||
|
2
Shovel/scripts/post-install.sh
Executable file
2
Shovel/scripts/post-install.sh
Executable file
@ -0,0 +1,2 @@
|
||||
cp scripts/index.html node_modules/swagger-tools/middleware/swagger-ui/
|
||||
cp scripts/shovel.conf /etc/init/shovel.conf
|
22
Shovel/scripts/shovel.conf
Executable file
22
Shovel/scripts/shovel.conf
Executable file
@ -0,0 +1,22 @@
|
||||
#!upstart
|
||||
description "start shovel server"
|
||||
|
||||
start on startup
|
||||
stop on shutdown
|
||||
|
||||
script
|
||||
export HOME="/root"
|
||||
echo $$ > /var/run/shovel.pid
|
||||
echo Starting shovel service
|
||||
chdir /var/Shovel/
|
||||
exec /usr/bin/nodejs main.js >> /var/log/shovel.log 2>&1
|
||||
end script
|
||||
|
||||
pre-start script
|
||||
echo "[`date -u +%Y-%m-%dT%T.%3NZ`] (sys) Starting" >> /var/log/shovel.log
|
||||
end script
|
||||
|
||||
pre-stop script
|
||||
rm /var/run/shovel.pid
|
||||
echo "[`date -u +%Y-%m-%dT%T.%3NZ`] (sys) Stopping" >> /var/log/shovel.log
|
||||
end script
|
Loading…
Reference in New Issue
Block a user