#!/bin/bash # This is intended to be run as a tool user set -Eeuo pipefail function usage { echo -e "Usage (must be toolforge user account):\n" echo "k8s_webservice.sh " echo "" echo "Example: k8s_webservice.sh start" } function startsvc { echo "starting..." cat <&2 '%s: user name does not start with "%s": %s\n' "$0" "$wmcsproject" "$USER" usage exit 1 fi prefix=$(($(echo -n $wmcsproject | wc -c)+1)) tool="${USER:prefix}" case $1 in start) startsvc "$tool" ;; stop) stopsvc "$tool" ;; restart) echo "For a restart, this seems kind of heavy" echo "Why don't you just run \"kubectl get pods\" and the \"kubectl delete pods \"?" ;; *) echo "There must be an argument of start or stop" usage exit 1 ;; esac