#!/bin/bash

#if we have network,reboot to get updates
ping -W 1 -c 1 u21.groovix.net
if [ $? -eq 0 ] ; then

	USER=guest groovix-root-run-in-display /usr/bin/groovix-no-x-activity-since-login  
	if [ $? -eq 0 ] ; then

		##normally reboots don't run gnc, override that
		#touch /var/lib/groovix/net-control/force-on-startup
		#echo rebooting for updates 
		#groovix-root-run-in-display zenity --info --title "Rebooting" --text "Rebooting for Updates" &
		#sleep 10
		#shutdown -r now
	
		groovix-shutdown-procedure --from=closing --update --reboot

	else
		echo "active user, not rebooting"
	fi


else
	echo "no network, not rebooting"
fi


