From 563b9023dcd3d9baa67b45b3e5cb10a2dc76ab67 Mon Sep 17 00:00:00 2001 From: Nathan Anderson Date: Thu, 27 Jul 2023 12:53:13 -0600 Subject: [PATCH] Added backup and deploy scripts --- data_backup.sh | 17 +++++++++++++++++ deploy.sh | 17 +++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100755 data_backup.sh create mode 100755 deploy.sh diff --git a/data_backup.sh b/data_backup.sh new file mode 100755 index 0000000..f82a115 --- /dev/null +++ b/data_backup.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +# Get the current timestamp in the format DD-MM-YY-TIME +timestamp=$(date +"%d-%m-%y-%H%M%S") + +# Define the source file and the destination directory and file +src="data.db" +dst_dir="backups" +dst_file="data-${timestamp}.db" + +# Make backups dir if necessary +mkdir -p $dst_dir + +# Move and rename the file +mv "${src}" "${dst_dir}/${dst_file}" + +echo "File has been moved to ${dst_dir} and renamed to ${dst_file}" \ No newline at end of file diff --git a/deploy.sh b/deploy.sh new file mode 100755 index 0000000..3265c30 --- /dev/null +++ b/deploy.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +echo 'Creating backup of database file...' + +./data_backup.sh + +echo 'Rebuilding server...' + +git pull + +zig build + +echo 'Restarting systemd...' + +sudo systemctl restart zerver + +systemctl status zerver