From f963f53b50ac237b5bf64a3b6654accf697f642d Mon Sep 17 00:00:00 2001 From: Nakul Manchanda Date: Mon, 1 Apr 2019 19:48:10 -0400 Subject: [PATCH] start restart script, missing feature Signed-off-by: Nakul Manchanda --- README.md | 8 ++++++++ scripts/restart-sample-node-api.sh | 7 +++++++ scripts/start-sample-node-api.sh | 5 ++++- server/routes/accountsCars.route.js | 6 ++++++ 4 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 scripts/restart-sample-node-api.sh diff --git a/README.md b/README.md index e4a1895..adb8dc4 100644 --- a/README.md +++ b/README.md @@ -125,6 +125,14 @@ from TN3270 terminal /s ZOWESVR ``` +Or, we can use zowe helper scripts to restart zowe +``` +ssh ibmuser@my.mainframe.com +cd /u/zowe/ibmuser/1.0.0/scripts +./zowe-stop.sh +./zowe-start.sh +``` + ### 2) Access newly deployed webservice behind api/v1 `https://my.mainframe.com:7554/api/v1/sample-node-api/accounts/` `https://my.mainframe.com:7554/api/v1/sample-node-api/accounts/1/` diff --git a/scripts/restart-sample-node-api.sh b/scripts/restart-sample-node-api.sh new file mode 100644 index 0000000..79f30b8 --- /dev/null +++ b/scripts/restart-sample-node-api.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +echo 'restarting sample node api...' +ps -elf | awk '/node/ && /app.js/ && !/sh -c/' | awk '{print $3}' | xargs kill -9 $1 +./start-sample-node-api.sh +sleep 30 +echo 'restart done' \ No newline at end of file diff --git a/scripts/start-sample-node-api.sh b/scripts/start-sample-node-api.sh index 98d70ad..1c2caa8 100644 --- a/scripts/start-sample-node-api.sh +++ b/scripts/start-sample-node-api.sh @@ -1,8 +1,11 @@ #!/bin/sh # find node bin +# export NODE_HOME=/usr/lpp/IBM/cnj/IBM/node-v6.14.4-os390-s390x +# export NODE_HOME=/usr/lpp/IBM/cnj/IBM/node-v6.14.4-os390-s390x if [ ! -z "$NODE_HOME" ]; then NODE_BIN=${NODE_HOME}/bin/node + NPM_CLI=${NODE_HOME}/lib/node_modules/npm/bin/npm-cli.js else echo "Error: cannot find node bin, node app did not start" exit 1 @@ -15,4 +18,4 @@ SCRIPT_DIR=$(dirname "$0") cd "$SCRIPT_DIR/.." # start service -$NODE_BIN server/app.js & \ No newline at end of file +$NODE_BIN $NPM_CLI run start > sample-node-api.log & \ No newline at end of file diff --git a/server/routes/accountsCars.route.js b/server/routes/accountsCars.route.js index 34f1239..1385064 100644 --- a/server/routes/accountsCars.route.js +++ b/server/routes/accountsCars.route.js @@ -3,10 +3,16 @@ const router = express.Router({ mergeParams: true }); const accountsCarsController = require('../controllers/accountsCars.controller'); +/* +// Add missing feature +// un-comment this to implement two new routes +// accounts/:id/cars & accounts/:id/cars/:id2 + router.route('/cars') .get(accountsCarsController.getAll); router.route('/cars/:_id') .get(accountsCarsController.get); +*/ module.exports = router; \ No newline at end of file