Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
hedgedoc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
infra
ansible
roles
hedgedoc
Commits
a9e5968f
Verified
Commit
a9e5968f
authored
3 years ago
by
psy
Browse files
Options
Downloads
Patches
Plain Diff
do not backup or mail emtpy pads
parent
d15b385e
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
files/hedgedoc-retention-cron.sh
+13
-8
13 additions, 8 deletions
files/hedgedoc-retention-cron.sh
with
13 additions
and
8 deletions
files/hedgedoc-retention-cron.sh
+
13
−
8
View file @
a9e5968f
...
...
@@ -24,18 +24,23 @@ while read -r pad owner; do
continue
fi
logger
-t
hedgedoc-util
"Processing pad
$pad
"
;
logger
-t
hedgedoc-util
"Processing pad
$pad
"
if
[
"
$BACKUP_ENABLED
"
=
true
]
;
then
hedgedoc-util pad get-content
$pad
>
$BACKUP_PATH
/
$(
date
+
"%Y%m%d"
)
_
$pad
.md
&&
logger
-t
hedgedoc-util
"backup successfull"
fi
content
=
$(
hedgedoc-util pad get-content
$pad
)
if
[
-z
$(
sed
's/[[:blank:]]//g'
<<<
"
$content
"
)
]
;
then
logger
-t
hedgedoc-util
"pad is empty"
else
if
[
"
$BACKUP_ENABLED
"
=
true
]
;
then
printf
"%s"
"
$content
"
>
$BACKUP_PATH
/
$(
date
+
"%Y%m%d"
)
_
$pad
.md
&&
logger
-t
hedgedoc-util
"backup successfull"
fi
if
[
"
$MAIL_ENABLED
"
=
true
]
;
then
hedgedoc-util pad mail
--convert
dokuwiki
--convert
markdown
--template
$MAIL_TEMPLATE
$pad
&&
logger
-t
hedgedoc-util
"mailed successfull"
if
[
"
$MAIL_ENABLED
"
=
true
]
;
then
hedgedoc-util pad mail
--convert
dokuwiki
--convert
markdown
--template
$MAIL_TEMPLATE
$pad
&&
logger
-t
hedgedoc-util
"mailed successfull"
fi
fi
hedgedoc-util pad delete
$pad
&&
\
logger
-t
hedgedoc-util
"Pad
$pad
deleted"
;
hedgedoc-util pad delete
$pad
&&
logger
-t
hedgedoc-util
"Pad
$pad
deleted"
done
< <
(
hedgedoc-util
--output
tsv-noheader pad list
-c
id
-c
ownerId
--last-change-older
$RETENTION_DAYS
)
if
[
"
$BACKUP_ENABLED
"
=
true
]
;
then
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment