Fixed Logger missing RUN_DIR
This commit is contained in:
parent
c99a1293c7
commit
59b7562a3e
|
@ -1,9 +1,9 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
SUBPROGRAM=[prgname]
|
SUBPROGRAM=[prgname]
|
||||||
PROGRAM="$SUBPROGRAM-batch" # Batch program to run osync / obackup instances sequentially and rerun failed ones
|
PROGRAM="$SUBPROGRAM-batch" # Batch program to run osync / obackup instances sequentially and rerun failed ones
|
||||||
AUTHOR="(L) 2013-2017 by Orsiris de Jong"
|
AUTHOR="(L) 2013-2018 by Orsiris de Jong"
|
||||||
CONTACT="http://www.netpower.fr - ozy@netpower.fr"
|
CONTACT="http://www.netpower.fr - ozy@netpower.fr"
|
||||||
PROGRAM_BUILD=2016120401
|
PROGRAM_BUILD=2018100101
|
||||||
|
|
||||||
## Runs an osync /obackup instance for every conf file found
|
## Runs an osync /obackup instance for every conf file found
|
||||||
## If an instance fails, run it again if time permits
|
## If an instance fails, run it again if time permits
|
||||||
|
@ -26,6 +26,15 @@ else
|
||||||
LOG_FILE=./$SUBPROGRAM-batch.log
|
LOG_FILE=./$SUBPROGRAM-batch.log
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
## Default directory where to store temporary run files
|
||||||
|
if [ -w /tmp ]; then
|
||||||
|
RUN_DIR=/tmp
|
||||||
|
elif [ -w /var/tmp ]; then
|
||||||
|
RUN_DIR=/var/tmp
|
||||||
|
else
|
||||||
|
RUN_DIR=.
|
||||||
|
fi
|
||||||
|
|
||||||
# No need to edit under this line ##############################################################
|
# No need to edit under this line ##############################################################
|
||||||
|
|
||||||
function _logger {
|
function _logger {
|
||||||
|
|
|
@ -2,8 +2,6 @@
|
||||||
|
|
||||||
## Installer script suitable for osync / obackup / pmocr
|
## Installer script suitable for osync / obackup / pmocr
|
||||||
|
|
||||||
include #### _OFUNCTIONS_BOOTSTRAP SUBSET ####
|
|
||||||
|
|
||||||
PROGRAM=[prgname]
|
PROGRAM=[prgname]
|
||||||
|
|
||||||
PROGRAM_VERSION=$(grep "PROGRAM_VERSION=" $PROGRAM.sh)
|
PROGRAM_VERSION=$(grep "PROGRAM_VERSION=" $PROGRAM.sh)
|
||||||
|
@ -12,12 +10,15 @@ PROGRAM_BINARY=$PROGRAM".sh"
|
||||||
PROGRAM_BATCH=$PROGRAM"-batch.sh"
|
PROGRAM_BATCH=$PROGRAM"-batch.sh"
|
||||||
SSH_FILTER="ssh_filter.sh"
|
SSH_FILTER="ssh_filter.sh"
|
||||||
|
|
||||||
SCRIPT_BUILD=2018070201
|
SCRIPT_BUILD=2018090301
|
||||||
|
INSTANCE_ID="installer-$SCRIPT_BUILD"
|
||||||
|
|
||||||
## osync / obackup / pmocr / zsnap install script
|
## osync / obackup / pmocr / zsnap install script
|
||||||
## Tested on RHEL / CentOS 6 & 7, Fedora 23, Debian 7 & 8, Mint 17 and FreeBSD 8, 10 and 11
|
## Tested on RHEL / CentOS 6 & 7, Fedora 23, Debian 7 & 8, Mint 17 and FreeBSD 8, 10 and 11
|
||||||
## Please adapt this to fit your distro needs
|
## Please adapt this to fit your distro needs
|
||||||
|
|
||||||
|
include #### _OFUNCTIONS_BOOTSTRAP SUBSET ####
|
||||||
|
|
||||||
# Get current install.sh path from http://stackoverflow.com/a/246128/2635443
|
# Get current install.sh path from http://stackoverflow.com/a/246128/2635443
|
||||||
SCRIPT_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
SCRIPT_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
|
||||||
|
@ -85,6 +86,15 @@ else
|
||||||
LOG_FILE="./$PROGRAM-install.log"
|
LOG_FILE="./$PROGRAM-install.log"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
## Default directory where to store temporary run files
|
||||||
|
if [ -w /tmp ]; then
|
||||||
|
RUN_DIR=/tmp
|
||||||
|
elif [ -w /var/tmp ]; then
|
||||||
|
RUN_DIR=/var/tmp
|
||||||
|
else
|
||||||
|
RUN_DIR=.
|
||||||
|
fi
|
||||||
|
|
||||||
include #### Logger SUBSET ####
|
include #### Logger SUBSET ####
|
||||||
include #### UrlEncode SUBSET ####
|
include #### UrlEncode SUBSET ####
|
||||||
include #### GetLocalOS SUBSET ####
|
include #### GetLocalOS SUBSET ####
|
||||||
|
@ -344,6 +354,26 @@ function Usage {
|
||||||
exit 127
|
exit 127
|
||||||
}
|
}
|
||||||
|
|
||||||
|
############################## Script entry point
|
||||||
|
|
||||||
|
if [ "$LOGFILE" == "" ]; then
|
||||||
|
if [ -w /var/log ]; then
|
||||||
|
LOG_FILE="/var/log/$PROGRAM.$INSTANCE_ID.log"
|
||||||
|
elif ([ "$HOME" != "" ] && [ -w "$HOME" ]); then
|
||||||
|
LOG_FILE="$HOME/$PROGRAM.$INSTANCE_ID.log"
|
||||||
|
else
|
||||||
|
LOG_FILE="./$PROGRAM.$INSTANCE_ID.log"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
LOG_FILE="$LOGFILE"
|
||||||
|
fi
|
||||||
|
if [ ! -w "$(dirname $LOG_FILE)" ]; then
|
||||||
|
echo "Cannot write to log [$(dirname $LOG_FILE)]."
|
||||||
|
else
|
||||||
|
Logger "Script begin, logging to [$LOG_FILE]." "DEBUG"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
GetLocalOS
|
GetLocalOS
|
||||||
SetLocalOSSettings
|
SetLocalOSSettings
|
||||||
GetInit
|
GetInit
|
||||||
|
|
Loading…
Reference in New Issue