Rebuilt targets
This commit is contained in:
parent
4c3aa02954
commit
ae2df407d8
|
@ -45,7 +45,7 @@ IS_STABLE=no
|
||||||
|
|
||||||
#### MINIMAL-FUNCTION-SET BEGIN ####
|
#### MINIMAL-FUNCTION-SET BEGIN ####
|
||||||
|
|
||||||
## FUNC_BUILD=2016090602
|
## FUNC_BUILD=2016090701
|
||||||
## BEGIN Generic bash functions written in 2013-2016 by Orsiris de Jong - http://www.netpower.fr - ozy@netpower.fr
|
## BEGIN Generic bash functions written in 2013-2016 by Orsiris de Jong - http://www.netpower.fr - ozy@netpower.fr
|
||||||
|
|
||||||
## To use in a program, define the following variables:
|
## To use in a program, define the following variables:
|
||||||
|
@ -771,13 +771,16 @@ function WaitForTaskCompletion {
|
||||||
|
|
||||||
# Take a list of commands to run, runs them sequentially with numberOfProcesses commands simultaneously runs
|
# Take a list of commands to run, runs them sequentially with numberOfProcesses commands simultaneously runs
|
||||||
# Returns the number of non zero exit codes from commands
|
# Returns the number of non zero exit codes from commands
|
||||||
|
# Use cmd1;cmd2;cmd3 syntax for small sets, use file for large command sets
|
||||||
function ParallelExec {
|
function ParallelExec {
|
||||||
local numberOfProcesses="${1}" # Number of simultaneous commands to run
|
local numberOfProcesses="${1}" # Number of simultaneous commands to run
|
||||||
local commandsArg="${2}" # Semi-colon separated list of commands, or file containing one command per line
|
local commandsArg="${2}" # Semi-colon separated list of commands, or file containing one command per line
|
||||||
|
local readFromFile="${3:-false}" # Is commandsArg a file or a string ?
|
||||||
|
|
||||||
|
__CheckArguments 3 $# ${FUNCNAME[0]} "$@" #__WITH_PARANOIA_DEBUG
|
||||||
|
|
||||||
local commandCount
|
local commandCount
|
||||||
local command
|
local command
|
||||||
local readFromFile=false
|
|
||||||
local pid
|
local pid
|
||||||
local counter=0
|
local counter=0
|
||||||
local commandsArray
|
local commandsArray
|
||||||
|
@ -790,9 +793,12 @@ function ParallelExec {
|
||||||
|
|
||||||
local hasPids=false # Are any valable pids given to function ? #__WITH_PARANOIA_DEBUG
|
local hasPids=false # Are any valable pids given to function ? #__WITH_PARANOIA_DEBUG
|
||||||
|
|
||||||
if [ -f "$commandsArg" ]; then
|
if [ $readFromFile == true ];then
|
||||||
commandCount=$(wc -l < "$commandsArg")
|
if [ -f "$commandsArg" ]; then
|
||||||
readFromFile=true
|
commandCount=$(wc -l < "$commandsArg")
|
||||||
|
else
|
||||||
|
commandCount=0
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
IFS=';' read -r -a commandsArray <<< "$commandsArg"
|
IFS=';' read -r -a commandsArray <<< "$commandsArg"
|
||||||
commandCount=${#commandsArray[@]}
|
commandCount=${#commandsArray[@]}
|
||||||
|
@ -804,6 +810,7 @@ function ParallelExec {
|
||||||
|
|
||||||
while [ $counter -lt "$commandCount" ] && [ ${#pidsArray[@]} -lt $numberOfProcesses ]; do
|
while [ $counter -lt "$commandCount" ] && [ ${#pidsArray[@]} -lt $numberOfProcesses ]; do
|
||||||
if [ $readFromFile == true ]; then
|
if [ $readFromFile == true ]; then
|
||||||
|
#TODO: Checked on FreeBSD 10, also check on Win
|
||||||
command=$(awk 'NR == num_line {print; exit}' num_line=$((counter+1)) "$commandsArg")
|
command=$(awk 'NR == num_line {print; exit}' num_line=$((counter+1)) "$commandsArg")
|
||||||
else
|
else
|
||||||
command="${commandsArray[$counter]}"
|
command="${commandsArray[$counter]}"
|
||||||
|
|
27
install.sh
27
install.sh
|
@ -4,7 +4,7 @@ PROGRAM=osync
|
||||||
PROGRAM_VERSION=1.2-beta
|
PROGRAM_VERSION=1.2-beta
|
||||||
PROGRAM_BINARY=$PROGRAM".sh"
|
PROGRAM_BINARY=$PROGRAM".sh"
|
||||||
PROGRAM_BATCH=$PROGRAM"-batch.sh"
|
PROGRAM_BATCH=$PROGRAM"-batch.sh"
|
||||||
SCRIPT_BUILD=2016082901
|
SCRIPT_BUILD=2016090605
|
||||||
|
|
||||||
## 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
|
## Tested on RHEL / CentOS 6 & 7, Fedora 23, Debian 7 & 8, Mint 17 and FreeBSD 8 & 10
|
||||||
|
@ -26,7 +26,7 @@ OSYNC_SERVICE_FILE_SYSTEMD_USER="osync-srv@.service.user"
|
||||||
|
|
||||||
## pmocr specfic code
|
## pmocr specfic code
|
||||||
PMOCR_SERVICE_FILE_INIT="pmocr-srv"
|
PMOCR_SERVICE_FILE_INIT="pmocr-srv"
|
||||||
PMOCR_SERVICE_FILE_SYSTEMD_SYSTEM="pmocr-srv.service"
|
PMOCR_SERVICE_FILE_SYSTEMD_SYSTEM="pmocr-srv@.service"
|
||||||
|
|
||||||
## Generic code
|
## Generic code
|
||||||
|
|
||||||
|
@ -141,19 +141,28 @@ function CreateConfDir {
|
||||||
|
|
||||||
function CopyExampleFiles {
|
function CopyExampleFiles {
|
||||||
if [ -f "./sync.conf.example" ]; then
|
if [ -f "./sync.conf.example" ]; then
|
||||||
cp "./sync.conf.example" "$FAKEROOT/etc/$PROGRAM/sync.conf.example"
|
cp "./sync.conf.example" "$CONF_DIR/sync.conf.example"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f "./host_backup.conf.example" ]; then
|
if [ -f "./host_backup.conf.example" ]; then
|
||||||
cp "./host_backup.conf.example" "$FAKEROOT/etc/$PROGRAM/host_backup.conf.example"
|
cp "./host_backup.conf.example" "$CONF_DIR/host_backup.conf.example"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f "./exlude.list.example" ]; then
|
if [ -f "./exlude.list.example" ]; then
|
||||||
cp "./exclude.list.example" "$FAKEROOT/etc/$PROGRAM"
|
cp "./exclude.list.example" "$CONF_DIR/exclude.list.example"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f "./snapshot.conf.example" ]; then
|
if [ -f "./snapshot.conf.example" ]; then
|
||||||
cp "./snapshot.conf.example" "$FAKEROOT/etc/$PROGRAM/snapshot.conf.example"
|
cp "./snapshot.conf.example" "$CONF_DIR/snapshot.conf.example"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -f "./default.conf" ]; then
|
||||||
|
if [ -f "$CONF_DIR/default.conf" ]; then
|
||||||
|
cp "./default.conf" "$CONF_DIR/default.conf.new"
|
||||||
|
QuickLogger "Copied default.conf to [$CONF_DIR/default.conf.new]."
|
||||||
|
else
|
||||||
|
cp "./default.conf" "$CONF_DIR/default.conf"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -200,7 +209,7 @@ function CopyServiceFiles {
|
||||||
QuickLogger "Cannot copy the systemd file to [$SERVICE_DIR_SYSTEMD_SYSTEM] or [$SERVICE_DIR_SYSTEMD_USER]."
|
QuickLogger "Cannot copy the systemd file to [$SERVICE_DIR_SYSTEMD_SYSTEM] or [$SERVICE_DIR_SYSTEMD_USER]."
|
||||||
else
|
else
|
||||||
QuickLogger "Created osync-srv service in [$SERVICE_DIR_SYSTEMD_SYSTEM] and [$SERVICE_DIR_SYSTEMD_USER]."
|
QuickLogger "Created osync-srv service in [$SERVICE_DIR_SYSTEMD_SYSTEM] and [$SERVICE_DIR_SYSTEMD_USER]."
|
||||||
QuickLogger "Can be activated with [systemctl start osync-srv@instance.conf] where instance.conf is the name of the config file in /etc/osync."
|
QuickLogger "Can be activated with [systemctl start osync-srv@instance.conf] where instance.conf is the name of the config file in $CONF_DIR."
|
||||||
QuickLogger "Can be enabled on boot with [systemctl enable osync-srv@instance.conf]."
|
QuickLogger "Can be enabled on boot with [systemctl enable osync-srv@instance.conf]."
|
||||||
QuickLogger "In userland, active with [systemctl --user start osync-srv@instance.conf]."
|
QuickLogger "In userland, active with [systemctl --user start osync-srv@instance.conf]."
|
||||||
fi
|
fi
|
||||||
|
@ -223,8 +232,8 @@ function CopyServiceFiles {
|
||||||
QuickLogger "Cannot copy the systemd file to [$SERVICE_DIR_SYSTEMD_SYSTEM] or [$SERVICE_DIR_SYSTEMD_USER]."
|
QuickLogger "Cannot copy the systemd file to [$SERVICE_DIR_SYSTEMD_SYSTEM] or [$SERVICE_DIR_SYSTEMD_USER]."
|
||||||
else
|
else
|
||||||
QuickLogger "Created pmocr-srv service in [$SERVICE_DIR_SYSTEMD_SYSTEM] and [$SERVICE_DIR_SYSTEMD_USER]."
|
QuickLogger "Created pmocr-srv service in [$SERVICE_DIR_SYSTEMD_SYSTEM] and [$SERVICE_DIR_SYSTEMD_USER]."
|
||||||
QuickLogger "Can be activated with [systemctl start pmocr-srv] after configuring file options in [$BIN_DIR/$PROGRAM]."
|
QuickLogger "Can be activated with [systemctl start pmocr-srv@default.conf] where default.conf is the name of the config file in $CONF_DIR."
|
||||||
QuickLogger "Can be enabled on boot with [systemctl enable pmocr-srv]."
|
QuickLogger "Can be enabled on boot with [systemctl enable pmocr-srv@default.conf]."
|
||||||
fi
|
fi
|
||||||
elif ([ "$init" == "initV" ] && [ -f "./$PMOCR_SERVICE_FILE_INIT" ]); then
|
elif ([ "$init" == "initV" ] && [ -f "./$PMOCR_SERVICE_FILE_INIT" ]); then
|
||||||
cp "./$PMOCR_SERVICE_FILE_INIT" "$SERVICE_DIR_INIT"
|
cp "./$PMOCR_SERVICE_FILE_INIT" "$SERVICE_DIR_INIT"
|
||||||
|
|
16
osync.sh
16
osync.sh
|
@ -11,7 +11,7 @@ IS_STABLE=no
|
||||||
|
|
||||||
#### MINIMAL-FUNCTION-SET BEGIN ####
|
#### MINIMAL-FUNCTION-SET BEGIN ####
|
||||||
|
|
||||||
## FUNC_BUILD=2016090602
|
## FUNC_BUILD=2016090701
|
||||||
## BEGIN Generic bash functions written in 2013-2016 by Orsiris de Jong - http://www.netpower.fr - ozy@netpower.fr
|
## BEGIN Generic bash functions written in 2013-2016 by Orsiris de Jong - http://www.netpower.fr - ozy@netpower.fr
|
||||||
|
|
||||||
## To use in a program, define the following variables:
|
## To use in a program, define the following variables:
|
||||||
|
@ -712,13 +712,15 @@ function WaitForTaskCompletion {
|
||||||
|
|
||||||
# Take a list of commands to run, runs them sequentially with numberOfProcesses commands simultaneously runs
|
# Take a list of commands to run, runs them sequentially with numberOfProcesses commands simultaneously runs
|
||||||
# Returns the number of non zero exit codes from commands
|
# Returns the number of non zero exit codes from commands
|
||||||
|
# Use cmd1;cmd2;cmd3 syntax for small sets, use file for large command sets
|
||||||
function ParallelExec {
|
function ParallelExec {
|
||||||
local numberOfProcesses="${1}" # Number of simultaneous commands to run
|
local numberOfProcesses="${1}" # Number of simultaneous commands to run
|
||||||
local commandsArg="${2}" # Semi-colon separated list of commands, or file containing one command per line
|
local commandsArg="${2}" # Semi-colon separated list of commands, or file containing one command per line
|
||||||
|
local readFromFile="${3:-false}" # Is commandsArg a file or a string ?
|
||||||
|
|
||||||
|
|
||||||
local commandCount
|
local commandCount
|
||||||
local command
|
local command
|
||||||
local readFromFile=false
|
|
||||||
local pid
|
local pid
|
||||||
local counter=0
|
local counter=0
|
||||||
local commandsArray
|
local commandsArray
|
||||||
|
@ -730,9 +732,12 @@ function ParallelExec {
|
||||||
local commandsArrayPid
|
local commandsArrayPid
|
||||||
|
|
||||||
|
|
||||||
if [ -f "$commandsArg" ]; then
|
if [ $readFromFile == true ];then
|
||||||
commandCount=$(wc -l < "$commandsArg")
|
if [ -f "$commandsArg" ]; then
|
||||||
readFromFile=true
|
commandCount=$(wc -l < "$commandsArg")
|
||||||
|
else
|
||||||
|
commandCount=0
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
IFS=';' read -r -a commandsArray <<< "$commandsArg"
|
IFS=';' read -r -a commandsArray <<< "$commandsArg"
|
||||||
commandCount=${#commandsArray[@]}
|
commandCount=${#commandsArray[@]}
|
||||||
|
@ -744,6 +749,7 @@ function ParallelExec {
|
||||||
|
|
||||||
while [ $counter -lt "$commandCount" ] && [ ${#pidsArray[@]} -lt $numberOfProcesses ]; do
|
while [ $counter -lt "$commandCount" ] && [ ${#pidsArray[@]} -lt $numberOfProcesses ]; do
|
||||||
if [ $readFromFile == true ]; then
|
if [ $readFromFile == true ]; then
|
||||||
|
#TODO: Checked on FreeBSD 10, also check on Win
|
||||||
command=$(awk 'NR == num_line {print; exit}' num_line=$((counter+1)) "$commandsArg")
|
command=$(awk 'NR == num_line {print; exit}' num_line=$((counter+1)) "$commandsArg")
|
||||||
else
|
else
|
||||||
command="${commandsArray[$counter]}"
|
command="${commandsArray[$counter]}"
|
||||||
|
|
Loading…
Reference in New Issue