IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 32543


Ignore:
Timestamp:
Oct 13, 2011, 9:58:45 AM (15 years ago)
Author:
rhenders
Message:

added time argument so it will cleanup every n hours

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippToPsps/jython/cleanup.py

    r32519 r32543  
    66import re
    77import sys
    8 
     8import time
    99import logging.config
    1010
     
    7777if len(sys.argv) > 1: CONFIG  = sys.argv[1]
    7878else:
    79     print "\n** Usage: " + sys.argv[0] + " <configPath>\n"
     79    print "\n** Usage: " + sys.argv[0] + " <configPath> [hours]\n"
    8080    sys.exit(1)
     81
     82if len(sys.argv) > 2:
     83    HOURS = float(sys.argv[2])
     84    SECONDS = HOURS * 60.0 * 60.0
     85else:
     86    SECONDS = None
    8187
    8288# open config file
     
    100106
    101107logger.infoTitle("ippToPsps clean-up")
     108if SECONDS: logger.infoPair("Performing clean-up every", "%f hours" % (SECONDS/60.0/60.0))
    102109logger.infoBool("Deleting from local disk?", DELETELOCAL)
    103110logger.infoBool("Deleting from datastore?", DELETEDATASTORE)
    104111logger.infoBool("Deleting from DXLayer?", DELETEDXLAYER)
    105112
    106 clean("P2")
    107 clean("ST")
     113while True:
     114
     115    clean("P2")
     116    clean("ST")
     117
     118    if SECONDS:
     119        logger.infoPair("Waiting for", "%f hours" % HOURS)
     120        time.sleep(SECONDS)
     121    else: break
     122   
Note: See TracChangeset for help on using the changeset viewer.