Improved osync-batch.sh for crontab execution
This commit is contained in:
parent
00342e610b
commit
c289e71548
|
@ -31,6 +31,7 @@ UNDER WORK
|
||||||
RECENT CHANGES
|
RECENT CHANGES
|
||||||
--------------
|
--------------
|
||||||
|
|
||||||
|
- Added detection of osync.sh script in osync-batch.sh to overcome mising path in crontab
|
||||||
- Fixed osync-batch.sh script when osync is in executable path like /usr/local/bin
|
- Fixed osync-batch.sh script when osync is in executable path like /usr/local/bin
|
||||||
- Fixed multiple keep logging messages since sleep time between commands has been lowered under a second
|
- Fixed multiple keep logging messages since sleep time between commands has been lowered under a second
|
||||||
- Added optional checksum parameter for the paranoid :)
|
- Added optional checksum parameter for the paranoid :)
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
PROGRAM="Osync-batch" # Batch program to run osync instances sequentially and rerun failed ones
|
PROGRAM="Osync-batch" # Batch program to run osync instances sequentially and rerun failed ones
|
||||||
AUTHOR="(L) 2013-2014 by Orsiris \"Ozy\" de Jong"
|
AUTHOR="(L) 2013-2014 by Orsiris \"Ozy\" de Jong"
|
||||||
CONTACT="http://www.netpower.fr/osync - ozy@netpower.fr"
|
CONTACT="http://www.netpower.fr/osync - ozy@netpower.fr"
|
||||||
PROGRAM_BUILD=2404201501
|
PROGRAM_BUILD=2504201501
|
||||||
|
|
||||||
## Runs an osync instance for every conf file found
|
## Runs an osync 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
|
||||||
|
@ -17,15 +17,6 @@ MAX_EXECUTION_TIME=36000
|
||||||
## Specifies the number of reruns an instance may get
|
## Specifies the number of reruns an instance may get
|
||||||
MAX_RERUNS=3
|
MAX_RERUNS=3
|
||||||
|
|
||||||
|
|
||||||
## Osync executable full path can be set here if it cannot be found on the system
|
|
||||||
if ! type -p osync.sh > /dev/null 2>&1
|
|
||||||
then
|
|
||||||
OSYNC_EXECUTABLE=./osync.sh
|
|
||||||
else
|
|
||||||
OSYNC_EXECUTABLE=$(type -p osync.sh)
|
|
||||||
fi
|
|
||||||
|
|
||||||
## Log file path
|
## Log file path
|
||||||
if [ -w /var/log ]
|
if [ -w /var/log ]
|
||||||
then
|
then
|
||||||
|
@ -47,6 +38,25 @@ function Log
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function CheckEnvironment
|
||||||
|
{
|
||||||
|
## Osync executable full path can be set here if it cannot be found on the system
|
||||||
|
if ! type -p osync.sh > /dev/null 2>&1
|
||||||
|
then
|
||||||
|
if [ -f /usr/local/bin/osync.sh ]
|
||||||
|
then
|
||||||
|
OSYNC_EXECUTABLE=/usr/local/bin/osync.sh
|
||||||
|
elif [ -f ./osync.sh ]
|
||||||
|
then
|
||||||
|
OSYNC_EXECUTABLE=./osync.sh
|
||||||
|
else
|
||||||
|
Log "Could not find osync.sh"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
OSYNC_EXECUTABLE=$(type -p osync.sh)
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
function Batch
|
function Batch
|
||||||
{
|
{
|
||||||
|
@ -77,8 +87,7 @@ function Batch
|
||||||
else
|
else
|
||||||
RUN_AGAIN=$RUN_AGAIN" $i"
|
RUN_AGAIN=$RUN_AGAIN" $i"
|
||||||
fi
|
fi
|
||||||
elif [ $verbose -eq 1 ]
|
else
|
||||||
then
|
|
||||||
Log "Run instance $(basename $i) succeed."
|
Log "Run instance $(basename $i) succeed."
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
@ -145,5 +154,6 @@ do
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
CheckEnvironment
|
||||||
Log "$(date) Osync batch run"
|
Log "$(date) Osync batch run"
|
||||||
Batch
|
Batch
|
||||||
|
|
Loading…
Reference in New Issue