#!/usr/bin/env bash # set -xv echo $0 typeset -r SCRIPT_NAME=${0#*/} typeset -r WORKING_DIR=/home/ubuntu/Pharo touch /tmp/${SCRIPT_NAME}.txt cd $WORKING_DIR || exit 1 if [[ $(find $WORKING_DIR -type f -name STARTED_PHARO.txt -mmin -$(echo $RANDOM % 53 | bc) | wc -l) -eq 0 ]]; then if [[ $(pgrep -f 'pharo.*pier' -c) -eq 0 ]]; then # nohup ./pharo -vm-display-null -vm-sound-null ./pier_addons.image --no-quit & nohup ./pharo ./pier_addons.image --no-quit & echo "INFO: Started pier by the automated script at $(date), $(uptime)." >> $WORKING_DIR/STARTED_PHARO.txt fi fi ################################################################################ # Planning to run this: # */2 * * * * /home/ubuntu/Pharo/check_pier.sh > /dev/null 2>&1 ################################################################################