Skip to content
Snippets Groups Projects
Commit e335ec2c authored by Hahn Axel (hahn)'s avatar Hahn Axel (hahn)
Browse files

scheduler: remove code

parent 00bf94cc
Branches
No related tags found
1 merge request!26Eliminate scheduler
...@@ -29,135 +29,4 @@ echo "ERROR: $0 was DISABLED." ...@@ -29,135 +29,4 @@ echo "ERROR: $0 was DISABLED."
echo "start $( dirname \"$0\" )/backup.sh by cron when you wish to start the backup." echo "start $( dirname \"$0\" )/backup.sh by cron when you wish to start the backup."
exit 1 exit 1
. `dirname $0`/jobhelper.sh
typeset -i rcScheduler=0
typeset -i rcTransfer=0
bStart=1
# --------------------------------------------------------------------------------
# checks
# --------------------------------------------------------------------------------
j_requireUser "root"
# --- read schedulerdata
j_read
cat << EOFschedulerinfo
execution times: $JOBDEF_INC at `_j_getvar ${JOBFILE} "start-time-inc"`
Full backup : $JOBDEF_FULL at `_j_getvar ${JOBFILE} "start-time-full"`
do today = $JOB_DOTODAY
type = $JOBDEF_TYPE $JOBDEF_AUTO
starttime = $JOBDEF_STARTTIME
stopfile = $JOB_DONEFILE
EOFschedulerinfo
if [ $JOB_DOTODAY -eq 0 ]; then
echo "ABORT: nothing to do today"
bStart=0
fi
# check: Backup bereits gelaufen?
ls -l ${JOB_DONEFILE}.* 2>/dev/null
if [ $? -eq 0 ]; then
echo
echo "ABORT: $JOB_DONEFILE was found"
bStart=0
else
echo "Job was not started yet."
fi
if [ ${JOBDEF_STARTTIME} -gt ${mytime} ]; then
echo "INFO: waiting for next run at ${JOBDEF_STARTTIME} ..."
bStart=0
fi
if [ "$1" = "-f" -o "$1" = "--force" ]; then
echo FORCE parameter detected.
echo Overriding settings to make an incremental backup now.
JOB_DOTODAY=1
JOBDEF_TYPE=inc
JOBDEF_STARTTIME=`date +%H%M`
bStart=1
fi
if [ "$1" = "-d" -o "$1" = "--dryrun" ]; then
echo DRYRUN parameter detected
bStart=0
fi
# --------------------------------------------------------------------------------
if [ $bStart -eq 1 ]; then
# ----- local dumps
echo "INFO: `date` - starting backup ... type $JOBDEF_TYPE - time $JOBDEF_STARTTIME " | tee -a $JOB_LOGFILE
touch "${JOB_DONEFILE}.01.START"
cat $JOBFILE >>$JOB_LOGFILE
echo "INFO: `date` - Making local backups ... ${DIR_SELF}/localdump.sh ALL" | tee -a $JOB_LOGFILE
${DIR_SELF}/localdump.sh ALL | tee -a $JOB_LOGFILE
rcScheduler=$?
echo "INFO: `date` - local backups were finished" | tee -a $JOB_LOGFILE
sleep 2
# ----- transfer
if [ -x "${DIR_SELF}/transfer.sh" ]; then
# transfer files
echo "INFO: `date` - Sending data to storage... ${DIR_SELF}/transfer.sh $JOBDEF_TYPE" | tee -a $JOB_LOGFILE
touch "${JOB_DONEFILE}.02.STARTTRANSFER"
${DIR_SELF}/transfer.sh $JOBDEF_TYPE $JOBDEF_AUTO 2>&1 | tee -a $JOB_LOGFILE
rcTransfer=$?
else
echo "SKIP - transfer.sh not found; all files will be kept on local filesystem only" | tee -a $JOB_LOGFILE
fi
rcScheduler=$rcScheduler+rcTransfer
echo "INFO: `date` - DONE" | tee -a $JOB_LOGFILE
touch "${JOB_DONEFILE}.03.DONE"
echo
echo log for this executed job is
ls -l $JOB_LOGFILE
echo
echo "INFO: `date` - cleanup logs"
echo find "${DIR_LOGS}" -mtime +28 -delete -print
find "${DIR_LOGS}" -mtime +28 -delete -print
echo
echo STATUS $0 exit with final returncode rc=$rcScheduler | tee -a $JOB_LOGFILE
echo
else
echo "Nothing to do."
fi
# --------------------------------------------------------------------------------
exit $rcScheduler
# -------------------------------------------------------------------------------- # --------------------------------------------------------------------------------
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment