Skip to content

Instantly share code, notes, and snippets.

@pandanote-info
Last active February 4, 2021 13:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pandanote-info/8b5de172f81542ac8e4e424e5d6231aa to your computer and use it in GitHub Desktop.
Save pandanote-info/8b5de172f81542ac8e4e424e5d6231aa to your computer and use it in GitHub Desktop.
GROWIの起動・終了を実行するとともに、その際に稼働状況をリモートのMariaDBに作成したテーブルに書き込むためのshell script
#!/bin/bash
#
# See https://pandanote.info/?p=7259 for details.
#
MODE="start"
SERVER="192.168.11.11"
if [ -n "$1" ]; then
MODE="stop"
fi
if [ ${MODE} != "stop" ]; then
mysql -h ${SERVER} -u serverstatus -p'Some password to store the status of the remote server.' -e "insert into serverstatus(status) value(1)" serverstatus
cd /opt/wiki/growi
npm run server:prod
else
mysql -h ${SERVER} -u serverstatus -p'Some password to store the status of the remote server.' -e "insert into serverstatus(status) value(0)" serverstatus
pkill --signal SIGINT node
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment