Add backup functionality to YAMS script
This commit is contained in:
parent
1b48411ddb
commit
ffdb38293b
14
yams
14
yams
@ -5,11 +5,13 @@ dc="docker compose -f <filename> -f <custom_file_filename>"
|
|||||||
install_directory="<install_directory>"
|
install_directory="<install_directory>"
|
||||||
|
|
||||||
option=${1:-"--help"}
|
option=${1:-"--help"}
|
||||||
|
destination=${2:-"."}
|
||||||
|
destination=$(realpath "$destination")
|
||||||
|
|
||||||
help() {
|
help() {
|
||||||
echo "yams - Yet Another Media Server"
|
echo "yams - Yet Another Media Server"
|
||||||
echo
|
echo
|
||||||
echo "Usage: yams [--help|restart|stop|start|destroy|check-vpn|update (deprecated)]"
|
echo "Usage: yams [--help|restart|stop|start|destroy|check-vpn|backup [destination]|update (deprecated)]"
|
||||||
echo "options:"
|
echo "options:"
|
||||||
echo "--help displays this help message"
|
echo "--help displays this help message"
|
||||||
echo "restart restarts yams services"
|
echo "restart restarts yams services"
|
||||||
@ -17,6 +19,7 @@ help() {
|
|||||||
echo "start starts yams services"
|
echo "start starts yams services"
|
||||||
echo "destroy destroy yams services so you can start from scratch"
|
echo "destroy destroy yams services so you can start from scratch"
|
||||||
echo "check-vpn checks if the VPN is working as expected"
|
echo "check-vpn checks if the VPN is working as expected"
|
||||||
|
echo "backup [destination] backs up yams to the destination location"
|
||||||
echo "update updates YAMS (deprecated)"
|
echo "update updates YAMS (deprecated)"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -114,3 +117,12 @@ fi
|
|||||||
if [ "$option" == "update" ]; then
|
if [ "$option" == "update" ]; then
|
||||||
echo "This command is deprecated. Please update YAMS manually."
|
echo "This command is deprecated. Please update YAMS manually."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ "$option" == "backup" ]; then
|
||||||
|
echo "Backing up YAMS to $destination..."
|
||||||
|
echo "This may take a while depending on the size of your installation."
|
||||||
|
echo "Please wait... ⌛"
|
||||||
|
tar --exclude='transcoding-temp' -cavf $destination/yams-backup-$(date '+%Y-%m-%d-%s').tar.gz $install_directory/
|
||||||
|
send_success_message "Backup completed successfully! 🎉"
|
||||||
|
echo "Backup file: $destination/yams-backup-$(date '+%Y-%m-%d-%s').tar.gz"
|
||||||
|
fi
|
||||||
|
Loading…
x
Reference in New Issue
Block a user