X-Git-Url: https://git.camperquake.de/gitweb.cgi?p=time-slider.git;a=blobdiff_plain;f=usr%2Fshare%2Ftime-slider%2Flib%2Ftime_slider%2Ftimesliderd.py;h=d281aab81763691ecbc92aee35c9802046a4ac86;hp=eb2e3417b9a6d0e39868dc7b2c3ba94b3c1bffb0;hb=1d212071bcde55b65dd992195929bc957904c6dc;hpb=d021224696e8524cab857c27370e33aeaf024130 diff --git a/usr/share/time-slider/lib/time_slider/timesliderd.py b/usr/share/time-slider/lib/time_slider/timesliderd.py index eb2e341..d281aab 100755 --- a/usr/share/time-slider/lib/time_slider/timesliderd.py +++ b/usr/share/time-slider/lib/time_slider/timesliderd.py @@ -1,4 +1,4 @@ -#!/usr/bin/python2.6 +#!/usr/bin/python2 # # CDDL HEADER START # @@ -31,6 +31,7 @@ import time import datetime import calendar import signal +import argparse import glib import gobject @@ -42,12 +43,14 @@ import dbus.mainloop.glib import dbussvc import zfs import smf -import timeslidersmf -import autosnapsmf -import plugin -from rbac import RBACprofile +import time_slider.linux.timeslidersmf as timeslidersmf +import time_slider.linux.autosnapsmf as autosnapsmf +# import plugin +from time_slider.linux.rbac import RBACprofile import util +import time_slider.linux.timesliderconfig as timesliderconfig + _MINUTE = 60 _HOUR = _MINUTE * 60 _DAY = _HOUR * 24 @@ -96,7 +99,7 @@ class SnapshotManager(threading.Thread): '/org/opensolaris/TimeSlider/autosnap', self) - self._plugin = plugin.PluginManager(self.verbose) + # self._plugin = plugin.PluginManager(self.verbose) self.exitCode = smf.SMF_EXIT_OK self.refresh() @@ -205,7 +208,7 @@ class SnapshotManager(threading.Thread): self._configure_svc_props() self._rebuild_schedules() self._update_schedules() - self._plugin.refresh() + # self._plugin.refresh() self._stale = False self._refreshLock.release() @@ -448,7 +451,7 @@ class SnapshotManager(threading.Thread): now = long(time.time()) while next != None and next <= now: label = self._take_snapshots(schedule) - self._plugin.execute_plugins(schedule, label) + # self._plugin.execute_plugins(schedule, label) self._refreshLock.acquire() self._update_schedules() next,schedule = self._next_due(); @@ -928,15 +931,16 @@ def create_daemon(): def main(argv): - # Check SMF invocation environment - if os.getenv("SMF_FMRI") == None or os.getenv("SMF_METHOD") != "start": - sys.stderr.write("Command line invocation of %s unsupported.\n" \ - % (sys.argv[0])) - sys.stderr.write("This command is intended for smf(5) invocation only.\n") - sys.exit(smf.SMF_EXIT_ERR_NOSMF) + parser = argparse.ArgumentParser() + parser.add_argument('--foreground', action='store_true', help='Do not daemonize', default=False) + parser.add_argument('--config', '-c', type=str, help='Configuration file', default='/etc/time-slider/timesliderd.conf') + args, _ = parser.parse_known_args() + + timesliderconfig.configfile = args.config # Daemonise the service. - create_daemon() + if not args.foreground: + create_daemon() # The user security attributes checked are the following: # Note that UID == 0 will match any profile search so