Changeset 604
- Timestamp:
- 01/13/07 20:25:56 (2 years ago)
- Files:
-
- cherokee-admin/cherokee-admin.py (modified) (3 diffs)
- cherokee-admin/cherokee.conf.brand_new (added)
- cherokee-admin/page_summary.py (modified) (1 diff)
- cherokee-admin/server.sh (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
cherokee-admin/cherokee-admin.py
r579 r604 22 22 from page_unknown import PageUnknown 23 23 24 DEFAULT_CONFIG_FILE = "/tmp/cherokee.conf" 24 25 25 DEFAULT_CHECKING_TIME = .5 26 MODIFIED_EXIT_CODE = 10027 26 MODIFIED_CHECK_ELAPSE = 1 27 28 # Paths 29 # 30 DEFAULT_CONFIG_FILE = "/etc/cherokee/cherokee.conf" 31 NEW_CONFIG_FILE = "cherokee.conf.brand_new" 32 33 # Exit codes 34 # 35 EXIT_IO_ERROR = 50 36 EXIT_MODIFIED = 100 37 38 # Global error flag 39 # 40 system_error = None 41 42 43 # Check configuration file 44 # 45 def check_configuration_file (fullpath): 46 global system_error 47 48 if not os.path.exists (fullpath): 49 try: 50 s = open (NEW_CONFIG_FILE, 'r') 51 content = s.read() 52 s.close() 53 except IOError: 54 system_error = "Couldn't read " + NEW_CONFIG_FILE 55 return system_error 56 57 try: 58 t = open (fullpath, 'w+') 59 t.write (content) 60 t.close() 61 except IOError: 62 system_error = "Couldn't create " + fullpath 63 return system_error 64 28 65 29 66 # Globals 30 67 # 31 68 theme = Theme() 32 config = cherokeeconf.Config(DEFAULT_CONFIG_FILE) 33 server = cherokeeconf.Server(config) 69 70 check_configuration_file (DEFAULT_CONFIG_FILE) 71 72 if not system_error: 73 config = cherokeeconf.Config(DEFAULT_CONFIG_FILE) 74 server = cherokeeconf.Server(config) 34 75 35 76 … … 72 113 self.output.write('Content-Type: text/html\r\n\r\n') 73 114 115 # System error 116 # 117 if system_error: 118 self.critical_error (system_error) 119 return 120 121 # Check the URL 122 # 74 123 uri = self.env['REQUEST_URI'] 75 124 if not uri: 76 self. _critical_error ('No REQUEST_URI')125 self.critical_error ('No REQUEST_URI') 77 126 return 78 127 … … 121 170 if development and scripts_changed (mlist): 122 171 srv.socket.close() 123 sys.exit ( MODIFIED_EXIT_CODE)172 sys.exit (EXIT_MODIFIED) 124 173 125 174 srv.handle_request() cherokee-admin/page_summary.py
r572 r604 38 38 except: 39 39 html = HTML_NOT_ALIVE 40 40 pid = "" 41 41 42 html = html.replace ('%%pid%%', str(pid)) 42 43 return html cherokee-admin/server.sh
r575 r604 41 41 python cherokee-admin.py $@ 42 42 if [ "$?" -ne 100 ]; then 43 echo "WARNING: Unknown exit error! $?" 43 echo "ERROR: Unknown exit error! $?" 44 exit $? 44 45 fi 45 46 echo "Server restarted: `date`"