Changeset 435 for trunk/jobarchived
- Timestamp:
- 07/11/07 16:57:42 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/jobarchived/jobarchived.py
r382 r435 32 32 import getopt, syslog, ConfigParser 33 33 34 def usage(): 35 36 print 37 print 'usage: jobarchived [options]' 38 print 'options:' 39 print ' --config, -c configuration file' 40 print ' --pidfile, -p pid file' 41 print ' --help, -h help' 42 print 43 34 44 def processArgs( args ): 35 45 36 SHORT_L = ' c:'37 LONG_L = 'config='46 SHORT_L = 'p:hc:' 47 LONG_L = [ 'help', 'config=', 'pidfile=' ] 38 48 39 49 config_filename = None 50 51 global PIDFILE 52 53 PIDFILE = None 40 54 41 55 try: … … 53 67 54 68 config_filename = value 69 70 if opt in [ '--pidfile', '-p' ]: 71 72 PIDFILE = value 73 74 if opt in [ '--help', '-h' ]: 75 76 usage() 77 sys.exit( 0 ) 55 78 56 79 if not config_filename: … … 1887 1910 sys.exit(0) # end parent 1888 1911 1912 write_pidfile() 1913 1889 1914 # Go to the root directory and set the umask 1890 1915 # … … 1977 2002 return time.strftime("%a %d %b %Y %H:%M:%S") 1978 2003 2004 def write_pidfile(): 2005 2006 # Write pidfile if PIDFILE exists 2007 if PIDFILE: 2008 2009 pid = os.getpid() 2010 2011 pidfile = open(PIDFILE, 'w') 2012 2013 pidfile.write( str( pid ) ) 2014 pidfile.close() 2015 1979 2016 # Ooohh, someone started me! Let's go.. 1980 2017 if __name__ == '__main__':
Note: See TracChangeset
for help on using the changeset viewer.