Changeset 307 for trunk/jobmond
- Timestamp:
- 04/17/07 17:02:55 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/jobmond/jobmond.py
r282 r307 24 24 import sys, getopt, ConfigParser 25 25 26 def usage(): 27 28 print 29 print 'usage: jobmond [options]' 30 print 'options:' 31 print ' --config, -c configuration file' 32 print ' --pidfile, -p pid file' 33 print ' --help, -h help' 34 print 35 36 26 37 def processArgs( args ): 27 38 … … 29 40 LONG_L = 'config=' 30 41 31 config_filename = None 42 global PIDFILE 43 PIDFILE = None 44 config_filename = '/etc/jobmond.conf' 32 45 33 46 try: … … 35 48 opts, args = getopt.getopt( args, SHORT_L, LONG_L ) 36 49 37 except getopt. error, detail:50 except getopt.GetoptError, detail: 38 51 39 52 print detail 53 usage() 40 54 sys.exit(1) 41 55 … … 46 60 config_filename = value 47 61 48 if not config_filename: 49 50 config_filename = '/etc/jobmond.conf' 62 if opt in [ '--pidfile', '-p' ]: 63 64 PIDFILE = value 65 66 if opt in [ '--help', '-h' ]: 67 68 usage() 69 sys.exit(1) 51 70 52 71 return loadConfig( config_filename ) … … 571 590 sys.exit(0) # end parent 572 591 592 write_pidfile() 593 573 594 # Go to the root directory and set the umask 574 595 # … … 606 627 sys.stderr.write( msg + '\n' ) 607 628 629 def write_pidfile(): 630 631 # Write pidfile if PIDFILE exists 632 if PIDFILE: 633 pid = os.getpid() 634 635 pidfile = open(PIDFILE, 'w') 636 pidfile.write(str(pid)) 637 pidfile.close() 638 608 639 def main(): 609 640 """Application start"""
Note: See TracChangeset
for help on using the changeset viewer.