mirror of
https://github.com/deajan/obackup.git
synced 2024-12-26 07:23:41 +01:00
Rebuilt targets
This commit is contained in:
parent
c822c6e3eb
commit
ce841a29ac
@ -7,12 +7,12 @@ PROGRAM="obackup"
|
||||
AUTHOR="(C) 2013-2016 by Orsiris de Jong"
|
||||
CONTACT="http://www.netpower.fr/obackup - ozy@netpower.fr"
|
||||
PROGRAM_VERSION=2.1-dev
|
||||
PROGRAM_BUILD=2016081501
|
||||
PROGRAM_BUILD=2016081502
|
||||
IS_STABLE=no
|
||||
|
||||
#### MINIMAL-FUNCTION-SET BEGIN ####
|
||||
|
||||
## FUNC_BUILD=2016081501
|
||||
## FUNC_BUILD=2016081602
|
||||
## BEGIN Generic functions for osync & obackup written in 2013-2016 by Orsiris de Jong - http://www.netpower.fr - ozy@netpower.fr
|
||||
|
||||
## type -p does not work on platforms other than linux (bash). If if does not work, always assume output is not a zero exitcode
|
||||
@ -588,9 +588,10 @@ function WaitForTaskCompletion {
|
||||
local caller_name="${4}" # Who called this function
|
||||
local exit_on_error="${5:-false}" # Should the function exit on subprocess errors
|
||||
local counting="${6:-true}" # Count time since function launch if true, script launch if false
|
||||
local keep_logging="${7:-0}" # Log a standby message every X seconds. Set to zero to disable logging
|
||||
|
||||
Logger "${FUNCNAME[0]} called by [$caller_name]." "PARANOIA_DEBUG" #__WITH_PARANOIA_DEBUG
|
||||
__CheckArguments 6 $# ${FUNCNAME[0]} "$@" #__WITH_PARANOIA_DEBUG
|
||||
__CheckArguments 7 $# ${FUNCNAME[0]} "$@" #__WITH_PARANOIA_DEBUG
|
||||
|
||||
local soft_alert=0 # Does a soft alert need to be triggered, if yes, send an alert once
|
||||
local log_ttime=0 # local time instance for comparaison
|
||||
@ -609,8 +610,6 @@ function WaitForTaskCompletion {
|
||||
|
||||
WAIT_FOR_TASK_COMPLETION=""
|
||||
|
||||
#TODO: need to find a way to properly handle processes in unterruptible sleep state
|
||||
|
||||
while [ ${#pidsArray[@]} -gt 0 ]; do
|
||||
newPidsArray=()
|
||||
for pid in "${pidsArray[@]}"; do
|
||||
@ -643,10 +642,12 @@ function WaitForTaskCompletion {
|
||||
exec_time=$SECONDS
|
||||
fi
|
||||
|
||||
if [ $((($exec_time + 1) % $KEEP_LOGGING)) -eq 0 ]; then
|
||||
if [ $log_ttime -ne $exec_time ]; then
|
||||
log_ttime=$exec_time
|
||||
Logger "Current tasks still running with pids [$(joinString , ${pidsArray[@]})]." "NOTICE"
|
||||
if [ $keep_logging -ne 0 ]; then
|
||||
if [ $((($exec_time + 1) % $keep_logging)) -eq 0 ]; then
|
||||
if [ $log_ttime -ne $exec_time ]; then # Fix when sleep time lower than 1s
|
||||
log_ttime=$exec_time
|
||||
Logger "Current tasks still running with pids [$(joinString , ${pidsArray[@]})]." "NOTICE"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
@ -659,12 +660,14 @@ function WaitForTaskCompletion {
|
||||
fi
|
||||
if [ $exec_time -gt $hard_max_time ] && [ $hard_max_time -ne 0 ]; then
|
||||
Logger "Max hard execution time exceeded for task [$caller_name] with pids [$(joinString , ${pidsArray[@]})]. Stopping task execution." "ERROR"
|
||||
KillChilds $pid
|
||||
if [ $? == 0 ]; then
|
||||
Logger "Task stopped successfully." "NOTICE"
|
||||
else
|
||||
Logger "Could not stop task." "ERROR"
|
||||
fi
|
||||
for pid in "${pidsArray[@]}"; do
|
||||
KillChilds $pid
|
||||
if [ $? == 0 ]; then
|
||||
Logger "Task with pid [$pid] stopped successfully." "NOTICE"
|
||||
else
|
||||
Logger "Could not stop task with pid [$pid]." "ERROR"
|
||||
fi
|
||||
done
|
||||
SendAlert
|
||||
errrorcount=$((errorcount+1))
|
||||
fi
|
||||
@ -2537,7 +2540,7 @@ function Main {
|
||||
if [ "$GET_BACKUP_SIZE" != "no" ]; then
|
||||
GetDirectoriesSize
|
||||
else
|
||||
TOTAL_FILES_SIZE=0
|
||||
TOTAL_FILES_SIZE=-1
|
||||
fi
|
||||
fi
|
||||
|
||||
|
33
obackup.sh
33
obackup.sh
@ -7,12 +7,12 @@ PROGRAM="obackup"
|
||||
AUTHOR="(C) 2013-2016 by Orsiris de Jong"
|
||||
CONTACT="http://www.netpower.fr/obackup - ozy@netpower.fr"
|
||||
PROGRAM_VERSION=2.1-dev
|
||||
PROGRAM_BUILD=2016081501
|
||||
PROGRAM_BUILD=2016081502
|
||||
IS_STABLE=no
|
||||
|
||||
#### MINIMAL-FUNCTION-SET BEGIN ####
|
||||
|
||||
## FUNC_BUILD=2016081501
|
||||
## FUNC_BUILD=2016081602
|
||||
## BEGIN Generic functions for osync & obackup written in 2013-2016 by Orsiris de Jong - http://www.netpower.fr - ozy@netpower.fr
|
||||
|
||||
## type -p does not work on platforms other than linux (bash). If if does not work, always assume output is not a zero exitcode
|
||||
@ -571,6 +571,7 @@ function WaitForTaskCompletion {
|
||||
local caller_name="${4}" # Who called this function
|
||||
local exit_on_error="${5:-false}" # Should the function exit on subprocess errors
|
||||
local counting="${6:-true}" # Count time since function launch if true, script launch if false
|
||||
local keep_logging="${7:-0}" # Log a standby message every X seconds. Set to zero to disable logging
|
||||
|
||||
|
||||
local soft_alert=0 # Does a soft alert need to be triggered, if yes, send an alert once
|
||||
@ -590,8 +591,6 @@ function WaitForTaskCompletion {
|
||||
|
||||
WAIT_FOR_TASK_COMPLETION=""
|
||||
|
||||
#TODO: need to find a way to properly handle processes in unterruptible sleep state
|
||||
|
||||
while [ ${#pidsArray[@]} -gt 0 ]; do
|
||||
newPidsArray=()
|
||||
for pid in "${pidsArray[@]}"; do
|
||||
@ -624,10 +623,12 @@ function WaitForTaskCompletion {
|
||||
exec_time=$SECONDS
|
||||
fi
|
||||
|
||||
if [ $((($exec_time + 1) % $KEEP_LOGGING)) -eq 0 ]; then
|
||||
if [ $log_ttime -ne $exec_time ]; then
|
||||
log_ttime=$exec_time
|
||||
Logger "Current tasks still running with pids [$(joinString , ${pidsArray[@]})]." "NOTICE"
|
||||
if [ $keep_logging -ne 0 ]; then
|
||||
if [ $((($exec_time + 1) % $keep_logging)) -eq 0 ]; then
|
||||
if [ $log_ttime -ne $exec_time ]; then # Fix when sleep time lower than 1s
|
||||
log_ttime=$exec_time
|
||||
Logger "Current tasks still running with pids [$(joinString , ${pidsArray[@]})]." "NOTICE"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
@ -640,12 +641,14 @@ function WaitForTaskCompletion {
|
||||
fi
|
||||
if [ $exec_time -gt $hard_max_time ] && [ $hard_max_time -ne 0 ]; then
|
||||
Logger "Max hard execution time exceeded for task [$caller_name] with pids [$(joinString , ${pidsArray[@]})]. Stopping task execution." "ERROR"
|
||||
KillChilds $pid
|
||||
if [ $? == 0 ]; then
|
||||
Logger "Task stopped successfully." "NOTICE"
|
||||
else
|
||||
Logger "Could not stop task." "ERROR"
|
||||
fi
|
||||
for pid in "${pidsArray[@]}"; do
|
||||
KillChilds $pid
|
||||
if [ $? == 0 ]; then
|
||||
Logger "Task with pid [$pid] stopped successfully." "NOTICE"
|
||||
else
|
||||
Logger "Could not stop task with pid [$pid]." "ERROR"
|
||||
fi
|
||||
done
|
||||
SendAlert
|
||||
errrorcount=$((errorcount+1))
|
||||
fi
|
||||
@ -2426,7 +2429,7 @@ function Main {
|
||||
if [ "$GET_BACKUP_SIZE" != "no" ]; then
|
||||
GetDirectoriesSize
|
||||
else
|
||||
TOTAL_FILES_SIZE=0
|
||||
TOTAL_FILES_SIZE=-1
|
||||
fi
|
||||
fi
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user