24 lines
356 B
Bash
24 lines
356 B
Bash
#!/bin/sh
|
|
|
|
set -e
|
|
|
|
GITEA_PROCESS="$(pgrep gitea)"
|
|
|
|
# Stop Gitea.
|
|
echo "Stopped Gitea..."
|
|
kill -STOP "$GITEA_PROCESS"
|
|
|
|
# Archive Gitea data.
|
|
echo "Archiving..."
|
|
cd /var/lib/gitea
|
|
tar cfJ ../archive.tar.xz .
|
|
cd ..
|
|
|
|
# Upload to S3.
|
|
echo "Uploading..."
|
|
aws s3 cp archive.tar.xz "$BOOT_URI"
|
|
|
|
# Restart Gitea.
|
|
kill -CONT "$GITEA_PROCESS"
|
|
echo "Restarted Gitea!"
|