#!/bin/bash set -eu dc="docker-compose -f " install_location="" option=${1:-"--help"} help() { echo "yams - Yet Another Media Server" echo echo "Usage: yams [--help|restart|stop|start|status]" echo "options:" echo "--help displays this help message" echo "restart restarts yams services" echo "stop stops all yams services" echo "start starts yams services" echo "destroy destroy yams services so you can start from scratch" } if [ $option == "--help" ]; then help exit 0 fi if [ $option == "restart" ]; then $dc stop && $dc up -d exit 0 fi if [ $option == "stop" ]; then $dc stop exit 0 fi if [ $option == "start" ]; then $dc up -d exit 0 fi if [ $option == "destroy" ]; then echo echo read -p "Are you sure you want to destroy all your yams services? THIS IS NOT RECOVERABLE! ⚠️ ️🚨 [y/N]: " destroy_now destroy_now=${destroy_now:-"n"} if [ $destroy_now == "y" ]; then $dc down echo echo echo "yams services were destroyed. To restart, run: " echo "\$ yams start" fi fi if [ $option == "create-backup" ]; then tar -czf "$install_location/backups/yams-backup-$(date '+\%Y-\%m-\%d-\%s').tar.gz" $install_location/config/* fi