File routenbuch.sh of Package routenbuch
#!/bin/bash
APP_DIR="/srv/www/webapps/routenbuch"
usage() {
echo "$(basename $0) rake|rails [OPTIONS]"
}
case $1 in
rake)
CMD="rake"
;;
rails)
CMD="rails"
;;
*)
usage
exit 0
;;
esac
shift
pushd $APP_DIR >/dev/null
# Create writeable .irb_history for user 'routenbuch'
if [ ! -r .irb_history ]; then
touch .irb_history
chown routenbuch: .irb_history
chmod u=rw,g=,o= .irb_history
fi
sudo -u routenbuch RAILS_ENV=production $APP_DIR/bin/$CMD "$@"
popd >/dev/null