Skip to content

Commit

Permalink
try to fix multiple co2monitor-invoker issue
Browse files Browse the repository at this point in the history
- leave it commented out though, too many bugs
  • Loading branch information
Yann Büchau committed Nov 23, 2016
1 parent 8437a9c commit 978970e
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 34 deletions.
22 changes: 20 additions & 2 deletions usr/bin/co2monitor-invoker
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#!/usr/bin/env python3
import sys, os
import sys, os, re
import time
import dbus
import dbus.mainloop.glib
import logging
import signal
from subprocess import Popen, PIPE
from subprocess import Popen, PIPE, check_output
from gi.repository import GLib

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -59,6 +59,24 @@ def wait_for_co2monitor_service_on_dbus(seconds=10):
# signal.alarm only returns full seconds
signal.alarm(0) # unset the alarm
return True

# def other_invoker_running():
# psaux = check_output(['ps','-eo','pid,cmd']).decode().split("\n")
# reg = re.compile("^\s*(?!{pid}).*python3\s+.*co2monitor-invoker".format(pid=os.getpid()))
# invokers = [ps for ps in psaux if reg.match(ps)]
# logger.debug(invokers)
# return len(invokers) > 0

# def wait_for_other_invoker_to_end():
# while other_invoker_running():
# time.sleep(0.1)

# # make sure to wait for other invokers to end
# if other_invoker_running():
# logger.debug(_("waiting for other co2monitor-invoker instances to end"))
# wait_for_other_invoker_to_end()
# else:
# logger.debug(_("no other co2monitor-invoker instances active"))


# check if the co2monitor service is already running
Expand Down
28 changes: 14 additions & 14 deletions usr/share/co2monitor/lang/de/LC_MESSAGES/co2monitor.po
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-11-22 13:38+0100\n"
"POT-Creation-Date: 2016-11-23 09:22+0100\n"
"PO-Revision-Date: 2016-11-22 13:56+0100\n"
"Last-Translator: \n"
"Language-Team: \n"
Expand Down Expand Up @@ -188,61 +188,61 @@ msgstr "Datenaufzeichnungsdatei '{}' geschlossen"
msgid "Stopped data logging on device {}"
msgstr "beende Datenaufzeichnung auf Gerät {}"

#: usr/bin/co2monitor-invoker:66
#: usr/bin/co2monitor-invoker:84
msgid "co2monitor is already running"
msgstr "co2monitor läuft bereits"

#: usr/bin/co2monitor-invoker:68
#: usr/bin/co2monitor-invoker:86
msgid "co2monitor is not running"
msgstr "co2monitor läuft nicht"

#: usr/bin/co2monitor-invoker:71
#: usr/bin/co2monitor-invoker:89
msgid "trying to start co2monitor via systemd's dbus interface..."
msgstr "versuche, co2monitor über das DBus Interface von systemd zu starten..."

#: usr/bin/co2monitor-invoker:80
#: usr/bin/co2monitor-invoker:98
msgid "instructed systemd via dbus to start co2monitor."
msgstr "systemd wurde über dbus angewiesen, co2monitor zu starten."

#: usr/bin/co2monitor-invoker:83
#: usr/bin/co2monitor-invoker:101
msgid "co2monitor was successfully started via systemd's dbus interface."
msgstr "co2monitor erfolgreich über das DBus-Interface von systemd gestartet."

#: usr/bin/co2monitor-invoker:85
#: usr/bin/co2monitor-invoker:103
msgid "co2monitor startup took too long via systemd, didn't work."
msgstr ""
"co2monitor über systemd zu starten, hat zu lange gedauert, nicht "
"funktioniert."

#: usr/bin/co2monitor-invoker:88
#: usr/bin/co2monitor-invoker:106
msgid "starting co2monitor via systemd's dbus interface didn't work."
msgstr ""
"co2monitor über das DBus Interface von systemd zu starten, hat nicht "
"funktioniert."

#: usr/bin/co2monitor-invoker:90
#: usr/bin/co2monitor-invoker:108
msgid "starting co2monitor via 'at now'..."
msgstr "starte co2monitor über 'at now'..."

#: usr/bin/co2monitor-invoker:97
#: usr/bin/co2monitor-invoker:115
msgid "co2monitor successfully started via 'at now'."
msgstr "co2monitor erfolgreich über 'at now' gestartet."

#: usr/bin/co2monitor-invoker:99
#: usr/bin/co2monitor-invoker:117
msgid "co2monitor startup took too long via 'at now', didn't work."
msgstr ""
"co2monitor über 'at now' zu starten, hat zu lange gedauert, nicht "
"funktioniert."

#: usr/bin/co2monitor-invoker:115
#: usr/bin/co2monitor-invoker:133
msgid "no DEVNAME environment variable given. Aborting."
msgstr "keine DEVNAME Umgebungsvariable. Abbruch."

#: usr/bin/co2monitor-invoker:118
#: usr/bin/co2monitor-invoker:136
msgid "DEVNAME environment variable: {}"
msgstr "DEVNAME Umgebungsvariable: {}"

#: usr/bin/co2monitor-invoker:121
#: usr/bin/co2monitor-invoker:139
msgid "DEVNAME environment variable '{}' is a non-existant file. Aborting."
msgstr "DEVNAME Umgebungsvariable '{}' ist keine existierende Datei. Abbruch."

Expand Down
41 changes: 23 additions & 18 deletions usr/share/co2monitor/lang/fr/LC_MESSAGES/co2monitor.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-11-22 13:38+0100\n"
"POT-Creation-Date: 2016-11-23 09:22+0100\n"
"PO-Revision-Date: 2016-11-22 13:51+0100\n"
"Last-Translator: \n"
"Language-Team: \n"
Expand Down Expand Up @@ -120,7 +120,8 @@ msgstr "inoccupé"

#: usr/lib/co2monitor/python/co2monitor/service.py:188
msgid "Request to stop logging on device {} - will terminate soon..."
msgstr "reçu ordre stop d'enregistrement pour appareil {} - vais arrêter bientôt..."
msgstr ""
"reçu ordre stop d'enregistrement pour appareil {} - vais arrêter bientôt..."

#: usr/lib/co2monitor/python/co2monitor/service.py:197
msgid "Shutting down logging thread of device {}"
Expand Down Expand Up @@ -186,57 +187,61 @@ msgstr "fichier d'enregistrement '{}' fermé"
msgid "Stopped data logging on device {}"
msgstr "arrêté enregistrement d'appareil {}"

#: usr/bin/co2monitor-invoker:66
#: usr/bin/co2monitor-invoker:84
msgid "co2monitor is already running"
msgstr "co2monitor marche déja"

#: usr/bin/co2monitor-invoker:68
#: usr/bin/co2monitor-invoker:86
msgid "co2monitor is not running"
msgstr "co2monitor ne marche pas"

#: usr/bin/co2monitor-invoker:71
#: usr/bin/co2monitor-invoker:89
msgid "trying to start co2monitor via systemd's dbus interface..."
msgstr "essai de lancer co2monitor par l'interface dbus de systemd..."

#: usr/bin/co2monitor-invoker:80
#: usr/bin/co2monitor-invoker:98
msgid "instructed systemd via dbus to start co2monitor."
msgstr "Instructé systemd par dbus de lancer co2monitor."

#: usr/bin/co2monitor-invoker:83
#: usr/bin/co2monitor-invoker:101
msgid "co2monitor was successfully started via systemd's dbus interface."
msgstr "co2monitor était lancé par l'interface dbus de systemd avec succès."

#: usr/bin/co2monitor-invoker:85
#: usr/bin/co2monitor-invoker:103
msgid "co2monitor startup took too long via systemd, didn't work."
msgstr "Lancer co2monitor par systemd n'a pas marché, ça durait trop longtemps."
msgstr ""
"Lancer co2monitor par systemd n'a pas marché, ça durait trop longtemps."

#: usr/bin/co2monitor-invoker:88
#: usr/bin/co2monitor-invoker:106
msgid "starting co2monitor via systemd's dbus interface didn't work."
msgstr "Lancer co2monitor par l'interface dbus de systemd n'a pas marché."

#: usr/bin/co2monitor-invoker:90
#: usr/bin/co2monitor-invoker:108
msgid "starting co2monitor via 'at now'..."
msgstr "lance co2monitor par 'at now'..."

#: usr/bin/co2monitor-invoker:97
#: usr/bin/co2monitor-invoker:115
msgid "co2monitor successfully started via 'at now'."
msgstr "co2monitor était lancé par 'at now' avec succès."

#: usr/bin/co2monitor-invoker:99
#: usr/bin/co2monitor-invoker:117
msgid "co2monitor startup took too long via 'at now', didn't work."
msgstr "Lancer co2monitor par 'at now' n'a pas marché, ça durait trop longtemps."
msgstr ""
"Lancer co2monitor par 'at now' n'a pas marché, ça durait trop longtemps."

#: usr/bin/co2monitor-invoker:115
#: usr/bin/co2monitor-invoker:133
msgid "no DEVNAME environment variable given. Aborting."
msgstr "pas de variable d'environnement DEVNAME. Interruption."

#: usr/bin/co2monitor-invoker:118
#: usr/bin/co2monitor-invoker:136
msgid "DEVNAME environment variable: {}"
msgstr "variable d'environnement DEVNAME: {}"

#: usr/bin/co2monitor-invoker:121
#: usr/bin/co2monitor-invoker:139
msgid "DEVNAME environment variable '{}' is a non-existant file. Aborting."
msgstr "variable d'environnement DEVNAME '{}' est un fichier pas existant. Interruption."
msgstr ""
"variable d'environnement DEVNAME '{}' est un fichier pas existant. "
"Interruption."

#~ msgid "co2monitor was started by {}"
#~ msgstr "Co2moniteur était lancé par {}."
Expand Down

0 comments on commit 978970e

Please sign in to comment.