- moves cron jobs to code - adds job to monitor disk usage - daily job: docker prune progress: mail commando werkt voor mij ook los nog niet - thoughts? Co-authored-by: Kiara Grouwstra <kiara@bij1.org> Reviewed-on: #14
This commit is contained in:
parent
409e717eb5
commit
693d86e8a8
|
@ -30,7 +30,7 @@ retry_files_enabled = false
|
||||||
stdout_callback = yaml
|
stdout_callback = yaml
|
||||||
|
|
||||||
# Define the list of the built-in callback plugins enabled by default.
|
# Define the list of the built-in callback plugins enabled by default.
|
||||||
callback_whitelist = timer
|
callback_enabled = timer
|
||||||
|
|
||||||
;callback_plugins = /my/plugins/callback
|
;callback_plugins = /my/plugins/callback
|
||||||
;roles_path = /my/roles
|
;roles_path = /my/roles
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
---
|
||||||
|
|
||||||
|
cron__jobs:
|
||||||
|
|
||||||
|
'renew-cert':
|
||||||
|
special_time: 'daily'
|
||||||
|
job: '/usr/bin/certbot renew --standalone >> /var/log/le-renew.log'
|
||||||
|
|
||||||
|
'check-disk-space':
|
||||||
|
special_time: 'hourly'
|
||||||
|
job: '/usr/local/lib/check-disk-space'
|
||||||
|
|
||||||
|
custom_files:
|
||||||
|
|
||||||
|
- dest: '/usr/local/lib/check-disk-space'
|
||||||
|
content: |
|
||||||
|
#!/bin/bash
|
||||||
|
CURRENT=$(df / | grep / | awk '{ print $5}' | sed 's/%//g')
|
||||||
|
THRESHOLD=80
|
||||||
|
|
||||||
|
if [ "$CURRENT" -gt "$THRESHOLD" ] ; then
|
||||||
|
mail -s "Disk Space $(hostname).bij1.net" log@bij1.org << EOF
|
||||||
|
Used disk: $CURRENT%
|
||||||
|
EOF
|
||||||
|
fi
|
|
@ -1,6 +1,6 @@
|
||||||
---
|
---
|
||||||
|
|
||||||
nullmailer__enabled: False
|
nullmailer__enabled: True
|
||||||
|
|
||||||
nullmailer__adminaddr: log@bij1.org
|
nullmailer__adminaddr: log@bij1.org
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
---
|
||||||
|
|
||||||
|
cron__jobs:
|
||||||
|
|
||||||
|
'docker-prune':
|
||||||
|
special_time: 'daily'
|
||||||
|
job: 'docker system prune --all --force >/dev/null 2>&1'
|
|
@ -0,0 +1,37 @@
|
||||||
|
---
|
||||||
|
|
||||||
|
cron__jobs:
|
||||||
|
|
||||||
|
'keepalive':
|
||||||
|
job: '/usr/local/lib/keepalive'
|
||||||
|
|
||||||
|
custom_files:
|
||||||
|
|
||||||
|
- dest: '/usr/local/lib/keepalive'
|
||||||
|
content: |
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
check_mariadb()
|
||||||
|
{
|
||||||
|
pidof mariadbd >/dev/null 2>&1
|
||||||
|
}
|
||||||
|
|
||||||
|
restart_mariadb()
|
||||||
|
{
|
||||||
|
echo "restarting mariadb"| logger -t keepalive
|
||||||
|
/etc/init.d/mariadb restart
|
||||||
|
}
|
||||||
|
|
||||||
|
check_mariadb || restart_mariadb
|
||||||
|
|
||||||
|
check_website()
|
||||||
|
{
|
||||||
|
curl $ALIVE_URL >/dev/null 2>&1
|
||||||
|
}
|
||||||
|
|
||||||
|
restart_apache()
|
||||||
|
{
|
||||||
|
systemctl restart apache2
|
||||||
|
}
|
||||||
|
|
||||||
|
check_website || restart_apache
|
|
@ -0,0 +1,6 @@
|
||||||
|
---
|
||||||
|
|
||||||
|
cron__jobs:
|
||||||
|
|
||||||
|
'persist-ci':
|
||||||
|
job: 'docker start woodpecker_woodpecker-server_1'
|
|
@ -0,0 +1,7 @@
|
||||||
|
---
|
||||||
|
|
||||||
|
cron__jobs:
|
||||||
|
|
||||||
|
'localize-trello':
|
||||||
|
special_time: 'daily'
|
||||||
|
job: '/home/kiara/localize-trello/trello.sh'
|
|
@ -0,0 +1,15 @@
|
||||||
|
---
|
||||||
|
|
||||||
|
cron__jobs:
|
||||||
|
|
||||||
|
'collect-stats':
|
||||||
|
job: '/usr/local/lib/collect-stats > /dev/null 2>&1'
|
||||||
|
|
||||||
|
custom_files:
|
||||||
|
|
||||||
|
- dest: '/usr/local/lib/collect-stats'
|
||||||
|
content: |
|
||||||
|
#!/bin/bash
|
||||||
|
echo "-----" >> /root/stats.txt
|
||||||
|
date >> stats.txt
|
||||||
|
/sbin/status >> stats.txt
|
|
@ -0,0 +1,11 @@
|
||||||
|
---
|
||||||
|
|
||||||
|
cron__jobs:
|
||||||
|
|
||||||
|
'restart-apache':
|
||||||
|
special_time: 'daily'
|
||||||
|
job: '/usr/sbin/apache2ctl graceful'
|
||||||
|
|
||||||
|
'restart-db':
|
||||||
|
special_time: 'daily'
|
||||||
|
job: 'systemctl restart mariadb'
|
|
@ -0,0 +1,4 @@
|
||||||
|
---
|
||||||
|
|
||||||
|
environment__host_variables:
|
||||||
|
- ALIVE_URL: https://wp-staging.bij1.net/
|
|
@ -0,0 +1,31 @@
|
||||||
|
---
|
||||||
|
|
||||||
|
cron__jobs:
|
||||||
|
|
||||||
|
'backup':
|
||||||
|
special_time: 'hourly'
|
||||||
|
job: '/usr/local/lib/backup-sites > /dev/null'
|
||||||
|
|
||||||
|
custom_files:
|
||||||
|
|
||||||
|
- dest: '/usr/local/lib/backup-sites'
|
||||||
|
content: |
|
||||||
|
#!/bin/bash
|
||||||
|
rsync -aP /etc /home/jelle/backup/
|
||||||
|
rsync -aP /var/log /home/jelle/backup/
|
||||||
|
apt-mark showauto > /home/jelle/backup/packages-auto.list
|
||||||
|
apt-mark showmanual > /home/jelle/backup/packages-manual.list
|
||||||
|
/usr/local/lib/backup-dbs
|
||||||
|
chown -R jelle:jelle /home/jelle/backup
|
||||||
|
|
||||||
|
- dest: '/usr/local/lib/backup-dbs'
|
||||||
|
content: |
|
||||||
|
#!/bin/bash
|
||||||
|
databases=`mysql -u root -e "SHOW DATABASES;" | tr -d "| " | grep -v Database`
|
||||||
|
|
||||||
|
for db in $databases; do
|
||||||
|
if [[ "$db" != "information_schema" ]] && [[ "$db" != "performance_schema" ]] && [[ "$db" != "mysql" ]] && [[ "$db" != _* ]] ; then
|
||||||
|
echo "Dumping database: $db"
|
||||||
|
mysqldump -u root --databases $db > /home/jelle/backup/dbs/$db.sql
|
||||||
|
fi
|
||||||
|
done
|
|
@ -0,0 +1,4 @@
|
||||||
|
---
|
||||||
|
|
||||||
|
environment__host_variables:
|
||||||
|
- ALIVE_URL: https://shop.bij1.org/
|
|
@ -94,3 +94,7 @@ crm
|
||||||
cloud
|
cloud
|
||||||
proxy
|
proxy
|
||||||
|
|
||||||
|
[wordpress]
|
||||||
|
wp
|
||||||
|
wp-staging
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue