change monit_exec_path to monitrc_path

This commit is contained in:
Ahmed Muawia Khan 2018-07-26 16:35:08 +02:00
parent 0faba2e31d
commit c3e1745dff

View File

@ -10,7 +10,7 @@ fi
monit_pid_path=${MONIT_PID_PATH:=$HOME/.bigchaindb-monit/monit_processes}
monit_script_path=${MONIT_SCRIPT_PATH:=$HOME/.bigchaindb-monit/monit_script}
monit_log_path=${MONIT_LOG_PATH:=$HOME/.bigchaindb-monit/logs}
monit_exec_path=${MONIT_EXEC_PATH:=$HOME/.monitrc}
monitrc_path=${MONITRC_PATH:=$HOME/.monitrc}
function usage() {
cat <<EOM
@ -36,7 +36,7 @@ function usage() {
ENV[MONIT_EXEC_PATH] || --monit-exec-path PATH
Absolute path to the directory to run the script form. (default: ${monit_exec_path})
Absolute path to the monit control file(monitrc). (default: ${monitrc_path})
-h|--help
Show this help and exit.
@ -60,7 +60,7 @@ while [[ $# -gt 0 ]]; do
shift
;;
--monit-exec-path)
monit_exec_path="$2"
monitrc_path="$2"
shift
;;
-h|--help)
@ -130,24 +130,24 @@ EOF
chmod +x ${monit_script_path}
# Handling overwriting of control file interactively
if [ -f "$monit_exec_path" ]; then
echo "$monit_exec_path already exists."
if [ -f "$monitrc_path" ]; then
echo "$monitrc_path already exists."
read -p "Overwrite[Y]? " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
echo "Overriding $monit_exec_path/.monitrc"
echo "Overriding $monitrc_path/.monitrc"
else
read -p "Enter absolute path to store Monit control file: " monit_exec_path
eval monit_exec_path="$monit_exec_path"
if [ ! -d "$(dirname $monit_exec_path)" ]; then
echo "Failed to save monit control file '$monit_exec_path': No such file or directory."
read -p "Enter absolute path to store Monit control file: " monitrc_path
eval monitrc_path="$monitrc_path"
if [ ! -d "$(dirname $monitrc_path)" ]; then
echo "Failed to save monit control file '$monitrc_path': No such file or directory."
exit 1
fi
fi
fi
# configure monitrc
cat >${monit_exec_path} <<EOF
cat >${monitrc_path} <<EOF
set httpd
port 2812
allow localhost
@ -167,7 +167,7 @@ check process tendermint
EOF
# Setting permissions for control file
chmod 0700 ${monit_exec_path}
chmod 0700 ${monitrc_path}
echo -e "BigchainDB process manager configured!"
set -o errexit