2022-12-01 22:05:28 +03:00

46 lines
1.1 KiB
Bash
Executable File

#!/usr/bin/env bash
if [ 0 -eq "$#" ]; then
echo "Usage $0 start/stop/status"
exit -1
fi
action=$1
container=playground
case $action in
"start")
cid=$(docker container ls -q -a -f name=$container)
if [ -z "$cid" ]; then
docker run -d --name $container \
-p 127.0.0.1:8089:8080 \
-v /srv/playground/storage:/verilog-playground-store \
--cpus=1 --memory=16g --memory-swap=16g \
$container
else
docker start $container
fi
;;
"stop")
# Press twice CRTL-C
docker kill -s SIGINT $container
docker kill -s SIGINT $container
;;
"status")
cid=$(docker container ls -q -f name=$container)
if [ -z "$cid" ]; then
echo "Stopped"
else
echo "Started"
fi
;;
"*")
echo "Unknown action $action. Actions start, stop and status are allowed"
;;
esac