ansible-roles/ghn-gcore/ghn-gcoreboot/templates/gcore.j2

34 lines
699 B
Django/Jinja

#!/bin/bash
SELF=$(cd $(dirname $0); pwd -P)/$(basename $0)
case "${1:-''}" in
'start')
test=$(cat /etc/passwd | cut -d":" -f1 | grep gcube)
for elemento in $test; do
echo "entering on $elemento"
path="/home/$elemento/startContainer.sh"
if [ -e "$path" ]
then
su $elemento -c "source $path"
fi
echo "exiting from $elemento"
done
;;
'stop')
test=$(cat /etc/passwd | cut -d":" -f1 | grep gcube)
for elemento in $test; do
echo "entering on $elemento"
path="/home/$elemento/stopContainer.sh"
if [ -e "$path" ]
then
su $elemento -c "source $path"
fi
echo "exiting from $elemento"
done
;;
*)
echo "Usage: $SELF {start|stop}"
exit 1
;;
esac