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:
|
if filename is None:
|
||||||
filename = CONFIG_DEFAULT_PATH
|
filename = CONFIG_DEFAULT_PATH
|
||||||
|
|
||||||
|
logger.error(filename)
|
||||||
logger.debug('file_config() will try to open `{}`'.format(filename))
|
logger.debug('file_config() will try to open `{}`'.format(filename))
|
||||||
with open(filename) as f:
|
with open(filename) as f:
|
||||||
try:
|
try:
|
||||||
@ -108,7 +109,7 @@ def file_config(filename=None):
|
|||||||
'Failed to parse the JSON configuration from `{}`, {}'.format(filename, err)
|
'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
|
return config
|
||||||
|
|
||||||
|
|||||||
@ -17,9 +17,14 @@ fi
|
|||||||
# log_path /var/log/monit/
|
# log_path /var/log/monit/
|
||||||
# exec path(for monitrc) could be /etc/monitrc, /usr/local/etc/monitrc
|
# exec path(for monitrc) could be /etc/monitrc, /usr/local/etc/monitrc
|
||||||
|
|
||||||
monit_pid_path=${MONIT_PID_PATH:=$HOME/monit_processes}
|
# Check if directory for monit logs exists
|
||||||
monit_script_path=${MONIT_SCRIPT_PATH:=$HOME/monit_script}
|
if [ ! -d "$HOME/.bigchaindb-monit" ]; then
|
||||||
monit_log_path=${MONIT_LOG_PATH:=$HOME/logs}
|
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}
|
monit_exec_path=${MONIT_EXEC_PATH:=$HOME}
|
||||||
|
|
||||||
function usage() {
|
function usage() {
|
||||||
@ -46,7 +51,7 @@ function usage() {
|
|||||||
|
|
||||||
ENV[MONIT_EXEC_PATH] || --monit-exec-path PATH
|
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
|
-h|--help
|
||||||
Show this help and exit.
|
Show this help and exit.
|
||||||
@ -97,6 +102,7 @@ if [ ! -d "$monit_pid_path" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
cat >${monit_script_path} <<EOF
|
cat >${monit_script_path} <<EOF
|
||||||
|
#!/bin/bash
|
||||||
case \$1 in
|
case \$1 in
|
||||||
|
|
||||||
start_bigchaindb)
|
start_bigchaindb)
|
||||||
@ -160,3 +166,13 @@ EOF
|
|||||||
|
|
||||||
# Setting permissions for control file
|
# 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