#!/bin/bash
echo "Start cronjob"


echo "test_git"
${HOME}/test/test_git.sh dev ${HOME}/test/aapackage/ ${HOME}/test/test_aapackage.sh 2>&1 >> ${HOME}/zlog/cron_gitpull.log



echo "home push"
${HOME}/zscript/homepush 2>&1 >> ${HOME}/zlog/cron_homepush.log



echo "conda backup"
${HOME}/zscript/conda_backup_all 2>&1 >> ${HOME}/zlog/cron_conda.log




echo "pyformat"
${HOME}/zscript/pyformat  ${HOME}/aagit/aapackage/aapackage  2>&1 >> ${HOME}/zlog/cron_pyformat.log


echo "autoscale"
${HOME}/zscript/zbatch_autoscale_test 2>&1 >> ${HOME}/zlog/cron_autoscale.log






##########################################################################
: <<'END_COMMENT'

#### All CronJobs
# 0 1 * * *  ${HOME}/zscript/cronjob  2>&1 >> ${HOME}/zlog/cronjob.log



  GNU nano 2.5.3                                             File: /tmp/crontab.JHBVJU/crontab                                                                                                 

# Edit this file to introduce tasks to be run by cron.
 # For example, set a higher log level to audit cron's work
 EXTRA_OPTS="-L 1"


# @reboot sleep 5 && su ubuntu -c "nohup  ${HOME}/anaconda3/bin/jupyter notebook --ip=0.0.0.0 --port=8888 --no-browser  &>> ${HOME}/project27/logfile_jupyter_server.txt"


###Clean zlog folder
@reboot sleep 15  && nohup   ${HOME}/zbatch_clean.sh  &>> ${HOME}/zlog/cron_zbatch.log


### Jupyter
@reboot sleep 11  &&  nohup  ${HOME}/anaconda3/bin/jupyter notebook --ip=0.0.0.0 --port=8888 --no-browser  &>> ${HOME}/zlog/jupyter_server.log


## S3 drive
@reboot sleep 10  &&  ${HOME}/zconda/goofys ztasks ${HOME}/zs3drive



#### Daily pull test
0 1 * * *  ${HOME}/test/test_git.sh dev ${HOME}/test/aapackage/ ${HOME}/test/test_aapackage.sh 2>&1 >> ${HOME}/zlog/cron_gitpull.log


#### Backup home_ubuntu
0 2 * * *  ${HOME}/zscript/homepush 2>&1 >> ${HOME}/zlog/cron_homepush.log






#
# Each task to run has to be defined through a single line
# indicating with different fields when the task will be run
# and what command to run for the task
#
# To define the time you can provide concrete values for
# minute (m), hour (h), day of month (dom), month (mon),
# and day of week (dow) or use '*' in these fields (for 'any').#
# Notice that tasks will be started based on the cron's system
# daemon's notion of time and timezones.
#
# Output of the crontab jobs (including errors) is sent through
# email to the user the crontab file belongs to (unless redirected).
#
# For example, you can run a backup of all your user accounts
# at 5 a.m every week with:
# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
#
# For more information see the manual pages of crontab(5) and cron(8)
#
# m h  dom mon dow   command





END_COMMENT
