Skip to content
Snippets Groups Projects
Verified Commit 0e756f37 authored by psy's avatar psy
Browse files

move config to config file

parent 1b89eb2a
No related branches found
No related tags found
No related merge requests found
RETENTION_DAYS={{ hedgedoc.retention_cron.retention_days }}
MAIL_ENABLED={{ hedgedoc.retention_cron.mail.enabled|bool|lower }}
MAIL_TEMPLATE="{{ hedgedoc.retention_cron.mail.template }}"
BACKUP_ENABLED={{ hedgedoc.retention_cron.backup.enabled|bool|lower }}
BACKUP_PATH="{{ hedgedoc.retention_cron.backup.path }}"
BACKUP_KEEP_DAYS={{ hedgedoc.retention_cron.backup.keep_days }}
\ No newline at end of file
...@@ -2,12 +2,18 @@ ...@@ -2,12 +2,18 @@
PATH=$PATH:/usr/local/bin:/usr/sbin PATH=$PATH:/usr/local/bin:/usr/sbin
RETENTION_DAYS={{ hedgedoc.retention_cron.retention_days }} # default values
MAIL_ENABLED={{ hedgedoc.retention_cron.mail.enabled|bool|lower }} RETENTION_DAYS=30
MAIL_TEMPLATE="{{ hedgedoc.retention_cron.mail.template }}" MAIL_ENABLED=false
BACKUP_ENABLED={{ hedgedoc.retention_cron.backup.enabled|bool|lower }} MAIL_TEMPLATE=/usr/local/etc/hedgedoc-util/mail.tpl
BACKUP_PATH="{{ hedgedoc.retention_cron.backup.path }}" BACKUP_ENABLED=true
BACKUP_KEEP_DAYS={{ hedgedoc.retention_cron.backup.keep_days }} BACKUP_PATH=/backup/hedgedoc/
BACKUP_KEEP_DAYS=60
# override default values if config exists
if test -f /usr/local/etc/hedgedoc-util/hedgedoc-retention-cron.cfg; then
. /usr/local/etc/hedgedoc-util/hedgedoc-retention-cron.cfg
fi
logger -t hedgedoc-util "Running retention cron script" logger -t hedgedoc-util "Running retention cron script"
...@@ -21,7 +27,7 @@ while read -r pad owner; do ...@@ -21,7 +27,7 @@ while read -r pad owner; do
logger -t hedgedoc-util "Processing pad $pad"; logger -t hedgedoc-util "Processing pad $pad";
if [ "$BACKUP_ENABLED" = true ]; then if [ "$BACKUP_ENABLED" = true ]; then
hedgedoc-util pad get-content $pad > $BACKUP_PATH/$pad.md && logger -t hedgedoc-util "backup successfull" hedgedoc-util pad get-content $pad > $BACKUP_PATH/$(date +"%Y%m%d")_$pad.md && logger -t hedgedoc-util "backup successfull"
fi fi
if [ "$MAIL_ENABLED" = true ]; then if [ "$MAIL_ENABLED" = true ]; then
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment