templates.bin.chowntree.sh Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of stool Show documentation
Show all versions of stool Show documentation
Runs multiple web applications in multiple tomcats on a single machine.
Stool is a command line tool that provides a lifecycle for stages:
create, configure, build, run and remove. A stage contains web applications,
that may come in different flavors: Maven war projects or artifacts
(GAV coordinates).
The newest version!
#! /bin/sh
# usage
# chowntree newUser dir*
SCRIPT=$(basename $0)
NEWUSER=$1; shift
if [ -z "$NEWUSER" ]; then
echo "$SCRIPT: missing newUser arguments" 1>&2
exit 1
fi
if [ "$NEWUSER" = "root" ]
then
echo "$SCRIPT: chown to root is not allowed" 1>&2
exit 1
fi
if ! id "$NEWUSER" > /dev/null 2>&1; then
echo "$SCRIPT: $NEWUSER: no such user" 1>&2
exit 1
fi
while true ; do
DIR=$1
if [ -z $DIR ] ; then
exit
fi
shift
chown -R "$NEWUSER" "$DIR"
RET=$?
if [ ! $RET -eq 0 ]; then
echo "FAILED: chown -R $NEWUSER $DIR"
exit $RET
fi
done