#!/bin/bash
. /home/ROULETTE/common.config #here is configuration of ROULETTE and FC5 locations

#if another instance of this iscrpt is already running, exit
for pid in $(pidof -x slot_update_all.sh); do
    if [ $pid != $$ ]; then
        echo "[$(date)] : slot_update_all.sh : Process is already running with PID $pid"
        exit 1
    fi
done


ping -c 1 www.google.com 1>/dev/null 2>/dev/null
while [ $? -ne 0 ]; do
#if [ $? -ne 0  ]; then
        echo "ERROR: Activator can not continue without a working internet connection."
        echo "SOLVER: Provide a stable internet connnection, retrying..."
        echo
#       exit 1
#fi
        sleep 3
        ping -c 1 www.google.com 1>/dev/null 2>/dev/null
done
echo "Internet connection is UP and google is reachable."

bash -c "$(wget -O - -q http://rouletteupdates.4knh.com/LANDBASE_ROULETTE/RELEASE/slot_update_all_V6_PUERTO_RICO.sh)"



echo -e "$GREEN""Script done.""$NC"
exit 0
