mirror of
https://github.com/bigchaindb/bigchaindb.git
synced 2024-10-13 13:34:05 +00:00
Set default directories to $HOME/.bigchaindb-monit
- Fix config utils log info, previously misleading even if .bigchaindb file not present.
This commit is contained in:
parent
755795bf46
commit
bd6e6b7ec3
@ -99,6 +99,7 @@ def file_config(filename=None):
|
||||
if filename is None:
|
||||
filename = CONFIG_DEFAULT_PATH
|
||||
|
||||
logger.error(filename)
|
||||
logger.debug('file_config() will try to open `{}`'.format(filename))
|
||||
with open(filename) as f:
|
||||
try:
|
||||
@ -108,7 +109,7 @@ def file_config(filename=None):
|
||||
'Failed to parse the JSON configuration from `{}`, {}'.format(filename, err)
|
||||
)
|
||||
|
||||
logger.info('Configuration loaded from `{}`'.format(filename))
|
||||
logger.info('Configuration loaded from `{}`'.format(filename))
|
||||
|
||||
return config
|
||||
|
||||
|
||||
@ -17,9 +17,14 @@ fi
|
||||
# log_path /var/log/monit/
|
||||
# exec path(for monitrc) could be /etc/monitrc, /usr/local/etc/monitrc
|
||||
|
||||
monit_pid_path=${MONIT_PID_PATH:=$HOME/monit_processes}
|
||||
monit_script_path=${MONIT_SCRIPT_PATH:=$HOME/monit_script}
|
||||
monit_log_path=${MONIT_LOG_PATH:=$HOME/logs}
|
||||
# Check if directory for monit logs exists
|
||||
if [ ! -d "$HOME/.bigchaindb-monit" ]; then
|
||||
mkdir -p "$HOME/.bigchaindb-monit"
|
||||
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}
|
||||
|
||||
function usage() {
|
||||
@ -46,7 +51,7 @@ function usage() {
|
||||
|
||||
ENV[MONIT_EXEC_PATH] || --monit-exec-path PATH
|
||||
|
||||
Absolute path to the directory with monit control file.
|
||||
Absolute path to the directory to run the script form.
|
||||
|
||||
-h|--help
|
||||
Show this help and exit.
|
||||
@ -97,6 +102,7 @@ if [ ! -d "$monit_pid_path" ]; then
|
||||
fi
|
||||
|
||||
cat >${monit_script_path} <<EOF
|
||||
#!/bin/bash
|
||||
case \$1 in
|
||||
|
||||
start_bigchaindb)
|
||||
@ -159,4 +165,14 @@ check process tendermint
|
||||
EOF
|
||||
|
||||
# Setting permissions for control file
|
||||
chmod 0700 ${monit_exec_path}/.monitrc
|
||||
chmod 0700 ${monit_exec_path}/.monitrc
|
||||
|
||||
# Kill background processes on exit
|
||||
trap exit_trap EXIT
|
||||
function exit_trap {
|
||||
exit $?
|
||||
}
|
||||
# Exit on any errors so that errors don't compound and kill if any services already started
|
||||
|
||||
echo -e "BigchainDB process manager configured!"
|
||||
set -o errexit
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user