Skip to content
Snippets Groups Projects
Commit c766678f authored by gust's avatar gust
Browse files

Small fixes for delete command

parent 2f952f6f
No related branches found
No related tags found
No related merge requests found
......@@ -29,6 +29,19 @@ function systemctl_param {
fi
}
function show_usage {
echo "Usage:"
echo " - start|status|enable|disable|restart|stop: command sent to systemctl."
echo " - ps|exec|logs: command sent to docker compose."
echo " - update: to update the current folder."
echo " - stats: show docker stats with names."
echo " - delete <domainname>: remove a libre.sh service."
exit 1
}
if [ $# -eq 0 ]; then
show_usage
fi
case "$1" in
start|status|enable|disable|restart|stop)
......@@ -62,7 +75,12 @@ case "$1" in
stats)
docker stats $(docker ps|grep -v "NAMES"|awk '{ print $NF }'|tr "\n" " ");;
delete)
read -p "Are you sure you want to delete ${2}? (yY)" -n 1 -r
if [ $# -ne 2 ]; then
echo "delete requires a domainname argument."
exit 1
fi
read -p "Are you sure you want to delete ${2}? (yN)" -n 1 -r
echo # (optional) move to a new line
if [[ $REPLY =~ ^[Yy]$ ]]
then
......@@ -72,6 +90,9 @@ case "$1" in
cd /data/domains
tar cvzf ${2}.tgz ./${2}
if [ -f ./${2}.tgz ]; then
if [ ! -d /data/domains/to_keep/ ]; then
mkdir /data/domains/to_keep/
fi
mv ${2}.tgz /data/domains/to_keep/
rm -rf /data/domains/${2}
rm -rf /system/haproxy/certs/${2}
......@@ -79,9 +100,5 @@ case "$1" in
fi
fi;;
*)
echo "Usage:"
echo " - start|status|enable|disable|restart|stop: command sent to systemctl."
echo " - ps|exec|logs: command sent to docker compose."
echo " - update: to update the current folder."
echo " - stats: show docker stats with names."
show_usage
esac
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment