rumgewurstel mit filenames
authorSandro Knauß <knauss@netzguerilla.net>
Mon, 08 Feb 2010 01:18:59 +0100
changeset 37 6e5bd561ddd0
parent 36 178fd966423d
child 38 254c00f3cbe0
child 44 e20909e61588
rumgewurstel mit filenames
iro/MyIro_daemon
iro/anbieter/sipgate.py
iro/anbieter/smstrade.py
iro/anbieter/smtp.py
iro/iro.py
--- a/iro/MyIro_daemon	Sun Feb 07 18:04:53 2010 +0100
+++ b/iro/MyIro_daemon	Mon Feb 08 01:18:59 2010 +0100
@@ -1,8 +1,9 @@
 #! /bin/sh
-NAME="IRO"
-DEAMON=/home/sandy/svn/iro/MyIro
+NAME="Iro"
+HOMEDIR=/home/hefee
+DEAMON=${HOMEDIR}/bin/MyIro
 DEAMON_OPTS=""
-PID=/home/sandy/var/run/$NAME.pid
+PID=${HOMEDIR}/var/run/$NAME.pid
 
 test -x $DEAMON || exit 0
 
@@ -11,7 +12,7 @@
 case "$1" in
   start)
 	log_daemon_msg "Starting $NAME" $NAME
-	if start-stop-daemon --start --quiet --oknodo --pidfile $PID --make-pidfile --background --chuid sandy --group sandy --chdir /home/sandy/svn/iro --startas $DEAMON -- $DEAMON_OPTS; then
+	if start-stop-daemon --start --quiet --background --oknodo --pidfile $PID --make-pidfile --user hefee --group hefee --chdir ${HOMEDIR} --startas $DEAMON -- $DEAMON_OPTS; then
 	    log_end_msg 0
 	else
 	    log_end_msg 1
@@ -41,4 +42,4 @@
 	exit 1
 esac
 
-exit 0
+exit 1
--- a/iro/anbieter/sipgate.py	Sun Feb 07 18:04:53 2010 +0100
+++ b/iro/anbieter/sipgate.py	Mon Feb 08 01:18:59 2010 +0100
@@ -34,10 +34,10 @@
         self.user=user
         self.password=password
 
-    def read_basic_config(self,filename):
+    def read_basic_config(self,filenames):
         """Read basic options from the config file"""
         cp = ConfigParser.ConfigParser()
-        cp.read([filename])
+        cp.read(filenames)
         self.user=cp.get(self.section, 'user')
         self.password=cp.get(self.section, 'password')
 
--- a/iro/anbieter/smstrade.py	Sun Feb 07 18:04:53 2010 +0100
+++ b/iro/anbieter/smstrade.py	Mon Feb 08 01:18:59 2010 +0100
@@ -80,10 +80,10 @@
         self.script = "/"  # full path to the script that will handle the request
         self.method = "POST" # method that will be used. Currently only POST is supported
 
-    def read_basic_config(self,filename):
+    def read_basic_config(self, filenames):
         """Read basic options from the config file"""
         cp = ConfigParser.ConfigParser()
-        cp.read([filename])
+        cp.read(filenames)
         self.key=cp.get(self.section, 'key')
         self.route=cp.get(self.section, 'route')
         self.from_=cp.get(self.section, 'from')
--- a/iro/anbieter/smtp.py	Sun Feb 07 18:04:53 2010 +0100
+++ b/iro/anbieter/smtp.py	Mon Feb 08 01:18:59 2010 +0100
@@ -19,8 +19,8 @@
 logger=logging.getLogger("SMTP")
 
 class SMTP():
-    def __init__(self,config_filename=None,section="smtp"):
-        self.config_filename=config_filename
+    def __init__(self,config_filenames=None,section="smtp"):
+        self.config_filenames=config_filenames
         self.section=section
         self.bStart=False
         self.bTLS=False
@@ -28,13 +28,13 @@
         self.max_recipients=1
         
 
-    def read_basic_config(self,config_filename=None):
+    def read_basic_config(self,config_filenames=None):
         """Read basic options from the config file"""
-        if not (config_filename is None):
-            self.config_filename=config_filename
+        if not (config_filenames is None):
+            self.config_filenames=config_filenames
         
         cp = ConfigParser.ConfigParser()
-        cp.read([self.config_filename])
+        cp.read(self.config_filenames)
         self.config_parser = cp
         self.send_from=cp.get(self.section, 'send_from')
         self.host=cp.get(self.section, 'host')
--- a/iro/iro.py	Sun Feb 07 18:04:53 2010 +0100
+++ b/iro/iro.py	Mon Feb 08 01:18:59 2010 +0100
@@ -101,16 +101,18 @@
     manager.start()
     
     
+    conf=["iro.conf", "~/iro.conf","/etc/iro/iro.conf"]
+
     #anbieter erzeugen und konfigurieren
 
     sip=MySipgate()
-    sip.read_basic_config("iro.conf")
+    sip.read_basic_config(conf)
     
     localhost=MySMTP()
-    localhost.read_basic_config("iro.conf")
+    localhost.read_basic_config(conf)
 
     smstrade=MySmstrade()
-    smstrade.read_basic_config("iro.conf")
+    smstrade.read_basic_config(conf)
     
     #Benutzerdatenbank erstellen
     queue = Queue()
@@ -134,7 +136,7 @@
 
     #Server starten
     cp = ConfigParser.ConfigParser()
-    cp.read(["iro.conf"])
+    cp.read(conf)
     cert=cp.get('server', 'cert')
     key=cp.get('server', 'key')
     server = SecureUserDBXMLRPCServer(addr=("localhost", 8000),