Example #1
0
def init_daemon():
    """
		Description:
			initialize alfr3d services 
	"""
    utilities.speakString("Initializing systems check")

    faults = 0

    # initial geo check
    try:
        utilities.speakString("Running geo scan")
        logger.info("Running a geoscan")
        ret = utilities.getLocation("freegeoip")
        if not ret[0]:
            raise Exception("Geo scan failed")
        utilities.speakString("Geo scan complete")
    except Exception, e:
        utilities.speakString("Failed to complete geo scan")
        logger.error("Failed to complete geoscan scan")
        logger.error("Traceback: " + str(e))
        faults += 1  # bump up fault counter
Example #2
0
import sys
from random import randint
from time import time, strftime, localtime

#import my own utilities
sys.path.append(os.path.join(os.path.join(os.getcwd(),os.path.dirname(__file__)),"../"))
import utilities

utilities.speakGreeting()

if (strftime("%p",localtime()) == "AM"):
	utilities.speakString("your time to rest has come to an end")
	utilities.speakTime()
	utilities.speakDate()

	loc = utilities.getLocation()
	utilities.getWeather(loc[1],loc[2])

	unread_count = utilities.getUnreadCount()
	if unread_count > 1:
		utilities.speakString("While you were sleeping "+str(unread_count)+" emails flooded your inbox")
	sys.exit(1)

else:
	utilities.speakTime()

	random = [
		"Unless we are burning the midnight oil, ",
		"If you are going to invent something new tomorrow, ",
		"If you intend on being charming tomorrow, "]