#!/bin/sh # DO NOT EDIT - This file is being maintained by Chef USER="<%= @user %>" DIR="<%= @basedir %>" LOGDIR="${DIR}/log" # start logging exec >"${LOGDIR}/$(date +%Y%m%d-%H%M).log" 2>&1 echo "Updating planet file..." sudo -u "$USER" "$DIR/bin/update-planet" echo "Running jobs..." if [ -d "$DIR/jobs" ]; then for job in `find "$DIR/jobs" -type f -executable | sort`; do user=`stat '--format=%U' $job` echo "Running '$job' as user '$user'..." su -c "$job" "$user" done fi echo echo "Expire old logs..." find "${LOGDIR}" -mtime +28 -delete echo "Done."