diff --git canto/canto.py canto/canto.py index 155b283..f52b368 100644 --- canto/canto.py +++ canto/canto.py @@ -50,6 +50,7 @@ def print_fetch_usage(): print "--force -f Force update, regardless of timeestamps." print "--daemon -d Run as a daemon." print "--background -b Background (implies -d)" + print "--interval -i Update interval when run as a daemon" print "" print_common_usage() @@ -80,10 +81,10 @@ class Main(): iam = "canto" elif sys.argv[0].endswith("canto-fetch"): - shortopts = 'hvVfdbD:C:L:F:S:' + shortopts = 'hvVfdbD:C:L:F:S:i:' longopts = ["help","version","verbose","force","dir=",\ "conf=", "log=", "fdir=","sdir=",\ - "daemon","background"] + "daemon","background", "interval="] iam = "fetch" else: @@ -163,6 +164,7 @@ class Main(): if iam == "fetch": # Process canto-fetch specific args. + updateInterval = 60 daemon = False background = False @@ -172,6 +174,9 @@ class Main(): if opt in ["-b","--background"]: background = True daemon = True + if opt in ["-i","--interval"]: + updateInterval = int(arg) + print "Update Interval ==", updateInterval, "Seconds" # Daemonize the process, which is sorta confusing # in this context, because daemonizing is running @@ -185,7 +190,7 @@ class Main(): if daemon: while 1: canto_fetch.main(self.cfg, optlist) - time.sleep(60) + time.sleep(updateInterval) oldcfg = self.cfg try : self.cfg = cfg.Cfg(conf_file, log_file, feed_dir,\