mirror of
https://github.com/thewesker/greptweet.git
synced 2025-12-20 04:01:06 -05:00
Backup script
This commit is contained in:
@@ -1,8 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
echo -n "$(date --iso-8601) "
|
|
||||||
for i in 1 10 20 30
|
|
||||||
do
|
|
||||||
echo -n "$i day(s): $(find /srv/www/greptweet.com/u -maxdepth 1 -mindepth 1 -type d -mtime -$i | wc -l), "
|
|
||||||
done
|
|
||||||
|
|
||||||
echo Total: $(find /srv/www/greptweet.com/u -maxdepth 1 -mindepth 1 -type d | wc -l)
|
|
||||||
8
backup/create-greptweet-backup.sh
Executable file
8
backup/create-greptweet-backup.sh
Executable file
@@ -0,0 +1,8 @@
|
|||||||
|
#!/bin/bash -ex
|
||||||
|
cd "${BASH_SOURCE%/*}" || exit 1
|
||||||
|
bundleDir=$PWD
|
||||||
|
wwwdir=/srv/www/backup.greptweet.com
|
||||||
|
cd /mnt/2tb/greptweet || exit 1
|
||||||
|
rsync -trvi --exclude 'tweets.txt.gz' --include '*/' --include '*.txt.gz' --exclude '*' --prune-empty-dirs core:/srv/www/greptweet.com/ . &> $wwwdir/rsync.log
|
||||||
|
find -name '*.gz' -type f -print0 | tar cf $wwwdir/tweets.tar --null -T -
|
||||||
|
$bundleDir/index.sh $wwwdir > $wwwdir/index.html
|
||||||
24
backup/index.sh
Executable file
24
backup/index.sh
Executable file
@@ -0,0 +1,24 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
test -d $1 || exit
|
||||||
|
|
||||||
|
cd $1
|
||||||
|
|
||||||
|
cat <<EOF
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html><head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<title>$(tar -tf tweets.tar | wc -l) twitter accounts</title>
|
||||||
|
<style>
|
||||||
|
html { background-image: url("http://greptweet.com/icons/greptweet_birdie.svg"); }
|
||||||
|
body { background-color: white; opacity: 0.8; font-size: 2em; }
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>Greptweet.com $(date --rfc-3339=date -r tweets.tar) backup</h1>
|
||||||
|
<p>
|
||||||
|
<a href=tweets.tar>$(du -sh tweets.tar)</a>
|
||||||
|
</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
EOF
|
||||||
Reference in New Issue
Block a user