add backup scripts

This commit is contained in:
Helmut K. C. Tessarek 2019-11-09 17:21:33 -05:00
parent 50e4d4b3f2
commit 41f85ed71d
No known key found for this signature in database
GPG Key ID: BE0985349D44DD00
2 changed files with 38 additions and 0 deletions

21
jnbugit Executable file
View File

@ -0,0 +1,21 @@
#!/bin/bash
BACKUP_DIR=/data/backup/joplin
export NODEJS_HOME=/usr/local/lib/nodejs/node-v12.13.0/bin
export NODEJS_GLOBAL_HOME=$HOME/.node_modules_global/bin
PATH=$HOME/bin:$NODEJS_GLOBAL_HOME:$NODEJS_HOME:$PATH
export PATH
D=`date +'%Y-%m-%d_%H-%M'`
joplin sync
joplin e2ee decrypt
cd "$BACKUP_DIR"
rm -f *.md
rm -f resources/*
joplin --log-level debug export --format raw "$BACKUP_DIR"
git add .
git commit -m "Update on ${D}"

17
jnbujex Executable file
View File

@ -0,0 +1,17 @@
#!/bin/bash
BACKUP_DIR=/data/backup/joplin
KEEP_DAYS=28
export NODEJS_HOME=/usr/local/lib/nodejs/node-v12.13.0/bin
export NODEJS_GLOBAL_HOME=$HOME/.node_modules_global/bin
PATH=$HOME/bin:$NODEJS_GLOBAL_HOME:$NODEJS_HOME:$PATH
export PATH
D=`date +'%Y-%m-%d_%H-%M'`
joplin sync
joplin e2ee decrypt
joplin export --format jex ${BACKUP_DIR}/joplin_${D}.jex
find ${BACKUP_DIR}/ -name '*.jex' -mtime +${KEEP_DAYS} -exec rm {} \;