forked from emmm-dee/github-backup-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexec.sh
More file actions
23 lines (17 loc) · 616 Bytes
/
exec.sh
File metadata and controls
23 lines (17 loc) · 616 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/sh
TIME_ZONE=${TIME_ZONE:=UTC}
echo "timezone=${TIME_ZONE}"
cp /usr/share/zoneinfo/${TIME_ZONE} /etc/localtime
echo "${TIME_ZONE}" >/etc/timezone
echo "$(date) - start backup scheduler"
while :; do
DATE=$(date +%Y%m%d-%H%M%S)
for u in $(echo $GITHUB_USER | tr "," "\n"); do
echo "$(date) - execute backup for ${u}, ${DATE}"
github-backup ${u} --token=$TOKEN --all --output-directory=/srv/var/${DATE}/${u} --private --gists
done
echo "$(date) - cleanup"
ls -d1 /srv/var/* | head -n -${MAX_BACKUPS} | xargs rm -rf
echo "$(date) - sleep for 1 day"
sleep 1d
done