In daemon mode (the default) tmda-ofmipd should write out a pid file.
Here is a crude attempt to do that.
--
Tim Rice Multitalents (707) 887-1469
[EMAIL PROTECTED]
--- tmda-0.92/bin/tmda-ofmipd.old Thu Dec 11 08:37:21 2003
+++ tmda-0.92/bin/tmda-ofmipd Thu Dec 11 12:14:32 2003
@@ -63,6 +63,11 @@
default is FQDN:8025 (i.e, port 8025 on the fully qualified
domain name for the local host).
+ -P <pid-file>
+ --pidfile <pid-file>
+ The file used to write the process ID if we run in background
+ mode. The default is /var/run/tmda-ofmipd.pid
+
-R proto[://host[:port]]
--remoteauth proto[://host[:port]][/dn]
Host to connect to to check username and password.
@@ -192,6 +197,7 @@
DEBUGSTREAM = Devnull()
proxyport = '%s:%s' % (FQDN, 8025)
program = sys.argv[0]
+pidfile = '/var/run/tmda-ofmipd.pid'
configdir = None
authprog = None
fallback = 0
@@ -261,7 +267,8 @@
try:
opts, args = getopt.getopt(sys.argv[1:],
- 'p:u:a:R:A:Fc:C:dVhfbS:v:t:', ['proxyport=',
+ 'p:P:u:a:R:A:Fc:C:dVhfbS:v:t:', ['proxyport=',
+ 'pidfile=',
'username=',
'authfile=',
'remoteauth=',
@@ -299,6 +306,8 @@
foreground = 0
elif opt in ('-p', '--proxyport'):
proxyport = arg
+ elif opt in ('-P', '--pidfile'):
+ pidfile = arg
elif opt in ('-u', '--username'):
username = arg
elif opt in ('-R', '--remoteauth'):
@@ -1226,6 +1235,9 @@
if Util.getfileuid(authfile) != pw_uid:
raise IOError, \
authfile + ' must be owned by UID ' + str(pw_uid)
+ if not foreground:
+ pidf=open(pidfile, 'w')
+ os.chmod(pidfile, 0644)
# try setegid()
os.setegid(Util.getgid(username))
# try setting the supplemental group ids
@@ -1242,7 +1254,11 @@
# Try to fork to go to daemon unless foreground mode
if not foreground:
signal.signal(signal.SIGHUP, signal.SIG_IGN) # ignore SIGHUP
- if os.fork() != 0:
+ pid = os.fork()
+ if pid != 0:
+ pidf.write(str(pid))
+ pidf.write('\n')
+ pidf.close()
sys.exit()
# Start the event loop
_________________________________________________
tmda-workers mailing list ([EMAIL PROTECTED])
http://tmda.net/lists/listinfo/tmda-workers