Added destroy to yams script

This commit is contained in:
Roger Gonzalez 2023-01-07 12:39:22 -03:00
parent acce9fd85c
commit 9acf1af0a2
Signed by: rogs
GPG Key ID: C7ECE9C6C36EC2E6

21
yams
View File

@ -11,9 +11,10 @@ help() {
echo "Usage: yams [--help|restart|stop|start|status]" echo "Usage: yams [--help|restart|stop|start|status]"
echo "options:" echo "options:"
echo "--help displays this help message" echo "--help displays this help message"
echo "restart restarts yams" echo "restart restarts yams services"
echo "stop stops yams" echo "stop stops all yams services"
echo "start starts yams" echo "start starts yams services"
echo "destroy destroy yams services so you can start from scratch"
} }
if [ $option == "--help" ]; then if [ $option == "--help" ]; then
@ -35,3 +36,17 @@ if [ $option == "start" ]; then
$dc up -d $dc up -d
exit 0 exit 0
fi 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