diff --git a/crontab-example b/crontab-example deleted file mode 100644 index 71130a0..0000000 --- a/crontab-example +++ /dev/null @@ -1,13 +0,0 @@ -# /etc/crontab: system-wide crontab -# Unlike any other crontab you don't have to run the `crontab' -# command to install the new version when you edit this file -# and files in /etc/cron.d. These files also have username fields, -# that none of the other crontabs do. - -SHELL=/bin/sh -PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin - -# m | h | day of month | month | day of week | user | command -3 0 * * * root docker -H tcp://127.0.0.1:2375 exec mysql-server /root/nettoyer_quotas.sh > /proc/1/fd/2 2>&1 -3 1 * * * root docker -H tcp://127.0.0.1:2375 exec mysql-server sh -c "mysqldump --databases mysql -uroot -pXXXXXXXX > /mnt/dumps/mysql_dump-mysql_`date +\%d-\%m-\%Y`" > /proc/1/fd/2 2>&1 -13 1 * * * root docker -H tcp://127.0.0.1:2375 exec mysql-server sh -c "mysqldump --databases gogs owncloud semanticscuttle -uroot -pXXXXXXXX > /mnt/dumps/mysql_dump_`date +\%d-\%m-\%Y`" > /proc/1/fd/2 2>&1 diff --git a/crontab-example.yaml b/crontab-example.yaml new file mode 100644 index 0000000..b224f48 --- /dev/null +++ b/crontab-example.yaml @@ -0,0 +1,101 @@ +jobs: + - name: test-sendmail + command: echo "test sending a mail" + schedule: + minute: "20" + hour: "0" + captureStdout: true + utc: false + onSuccess: + report: + mail: + from: ovh1 + to: mail@mail.net + smtpHost: 127.0.0.1 + +# - name: duplicity-stack +# command: docker -H tcp://127.0.0.1:2375 exec cron-duplicity /root/gen_bootstrap.sh +# schedule: +# minute: "26" +# hour: "4" +# utc: false +# captureStdout: true +# captureStderr: true + + - name: mysql-stack-01 + command: docker -H tcp://127.0.0.1:2375 exec mysql-server /root/nettoyer_quotas.sh + schedule: + minute: "3" + hour: "0" + utc: false + captureStdout: true + captureStderr: true + onFailure: + report: + mail: + from: ovh1 + to: mail@mail.net + smtpHost: 127.0.0.1 + + - name: mysql-stack-02 + command: docker -H tcp://127.0.0.1:2375 exec mysql-server sh -c "mysqldump --databases mysql -uroot -pXXXXXXX > /mnt/dumps/mysql_dump-mysql_`date +\%d-\%m-\%Y`" + schedule: + minute: "3" + hour: "1" + utc: false + captureStdout: true + captureStderr: true + onFailure: + report: + mail: + from: ovh1 + to: mail@mail.net + smtpHost: 127.0.0.1 + + - name: mysql-stack-03 + command: docker -H tcp://127.0.0.1:2375 exec mysql-server sh -c "mysqldump --databases gogs owncloud semanticscuttle -uroot -pXXXXXXX > /mnt/dumps/mysql_dump_`date +\%d-\%m-\%Y`" + schedule: + minute: "13" + hour: "1" + utc: false + captureStdout: true + captureStderr: true + onFailure: + report: + mail: + from: ovh1 + to: mail@mail.net + smtpHost: 127.0.0.1 + + - name: reverse-proxy-stack + command: docker -H tcp://127.0.0.1:2375 exec dockerreverseproxystack_reverse-proxy_1 certbot renew + schedule: + minute: "5" + hour: "2" + utc: false + captureStdout: true + captureStderr: true + failsWhen: + producesStderr: false + producesStdout: false + onFailure: + report: + mail: + from: ovh1 + to: mail@mail.net + smtpHost: 127.0.0.1 + + - name: mail-stack + command: docker -H tcp://127.0.0.1:2375 exec dovecot /root/dovecot_expire.sh + schedule: + minute: "30" + hour: "0" + utc: false + captureStdout: true + captureStderr: true + onFailure: + report: + mail: + from: ovh1 + to: mail@mail.net + smtpHost: 127.0.0.1 diff --git a/docker-compose.yml b/docker-compose.yml index 0d9fde6..56d4a57 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,4 +7,4 @@ services: restart: always network_mode: "host" volumes: - - ./crontab:/etc/crontab:Z + - ./crontab.yaml:/root/crontab.yaml:Z diff --git a/start_or_update.sh b/start_or_update.sh index e44a282..f507f61 100755 --- a/start_or_update.sh +++ b/start_or_update.sh @@ -10,9 +10,9 @@ then exit 1 fi fi -openssl enc -aes-256-cbc -d -in ~/secrets.tar.gz.enc | tar -zxv --strip 2 secrets/docker-cron-global-stack${HOST}${INSTANCE}/crontab -sudo chown root. crontab -sudo chmod 644 crontab +openssl enc -aes-256-cbc -d -in ~/secrets.tar.gz.enc | tar -zxv --strip 2 secrets/docker-cron-global-stack${HOST}${INSTANCE}/crontab.yaml +sudo chown root. crontab.yaml +sudo chmod 644 crontab.yaml unset VERSION_CRON export VERSION_CRON=$(git ls-remote https://git.scimetis.net/yohan/docker-cron.git| head -1 | cut -f 1|cut -c -10)