Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorBenjamin Saller <bcsaller@objectrealms.net>2007-05-30 19:06:49 (GMT)
committer Benjamin Saller <bcsaller@objectrealms.net>2007-05-30 19:06:49 (GMT)
commita7ec17405dc52d71da09c08731261a4eecb394d0 (patch)
tree0b1df67ebf0c1b02745a804eecb89ee6e587ab23 /bin
parent505ae7e30f4fa0001174dd69ffcfc0222c210a82 (diff)
remove lockfile patch :(
Diffstat (limited to 'bin')
-rwxr-xr-xbin/datastore9
-rwxr-xr-xbin/datastore-service16
-rwxr-xr-xbin/index-service6
3 files changed, 29 insertions, 2 deletions
diff --git a/bin/datastore b/bin/datastore
index 7dc8665..ae8db9d 100755
--- a/bin/datastore
+++ b/bin/datastore
@@ -17,6 +17,15 @@ def handle_shutdown(signum, frame):
dsa.stop()
raise SystemExit("Shutting down on signal %s" % signum)
+# check for old lockfiles, the rules here are that we can't be
+# connected to a tty. If we are not then in all likelyhood the process
+# was started automatically, which hopefully implies a single instance
+if not sys.stdin.isatty():
+ lf = os.path.join(repo_dir, 'fulltext', 'flintlock')
+ if os.path.exists(lf):
+ logging.warning("Old lock file found -- removing.")
+ os.unlink(lf)
+
class DataStoreApplication(Application):
def manage_options(self):
diff --git a/bin/datastore-service b/bin/datastore-service
index 40e755f..3e036d8 100755
--- a/bin/datastore-service
+++ b/bin/datastore-service
@@ -22,15 +22,29 @@ if not os.path.exists(log_dir): os.makedirs(log_dir)
os.chdir(repo_dir)
# setup logger
+filename = None
+if not sys.stdin.isatty():
+ filename = os.path.join(log_dir, "datastore.log")
+
logging.basicConfig(level=logging.WARNING,
format="%(asctime)-15s %(levelname)s: %(message)s",
- filename = os.path.join(log_dir, "datastore.log"),
+ filename = filename,
)
# disable subsystem logging except where critical
logging.getLogger('sqlalchemy').setLevel(logging.CRITICAL)
logging.getLogger('lemur').setLevel(logging.CRITICAL)
logger = logging.getLogger(DS_LOG_CHANNEL)
+# check for old lockfiles, the rules here are that we can't be
+# connected to a tty. If we are not then in all likelyhood the process
+# was started automatically, which hopefully implies a single instance
+if not sys.stdin.isatty():
+ lf = os.path.join(repo_dir, 'fulltext', 'flintlock')
+ if os.path.exists(lf):
+ logging.warning("Old lock file found -- removing.")
+ os.unlink(lf)
+
+
# build the datastore
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
bus = dbus.SessionBus()
diff --git a/bin/index-service b/bin/index-service
index af6322e..5db5b30 100755
--- a/bin/index-service
+++ b/bin/index-service
@@ -33,12 +33,16 @@ if not os.path.exists(log_dir): os.makedirs(log_dir)
os.chdir(repo_dir)
# setup logger
+filename = None
+if not sys.stdin.isatty():
+ filename = os.path.join(log_dir, "indexer.log")
logging.basicConfig(level=logging.WARNING,
format="%(asctime)-15s %(levelname)s: %(message)s",
- filename = os.path.join(log_dir, "indexer.log"),
+ filename = filename,
)
logger = logging.getLogger('org.laptop.sugar.Indexer')
+logger.setLevel(logging.DEBUG)
class IndexService(Application):
def manage_options(self):