Example #1
0
def adminCronRunBG(handler, p_name):
	handler.wrappers = False

	for job in Cron.getJobs():
		if job.name == p_name:
			bg(job.run)
			Event.cron(handler, p_name)
			handler.responseCode = 299
			print "Job started. Requests are blocked until it finished. The page will reload automatically"
			return

	print "Unknown job: %s" % stripTags(p_name)
Example #2
0
def adminCron(handler):
	handler.title('Cron jobs')
	requirePriv(handler, 'Admin')

	for job in Cron.getJobs():
		print "<form method=\"post\" action=\"/admin/cron/run\">"
		print "<input type=\"hidden\" name=\"name\" value=\"%s\">" % job.name
		print "<h2>%s</h2>" % job.name
		print "<b>Last run: %s</b>&nbsp;&nbsp;&nbsp;%s<br>" % (job.lastrun.strftime('%d %b %Y %H:%M:%S') if job.lastrun else 'Never', Button('run now').mini().post())

		if job.log:
			print "<div class=\"cron-log\">%s</div>" % job.log
		else:
			print "<br>"
		print "</form>"
	print "<br><br>"
Example #3
0
# Writing the pidfile
pidFile = option('pidfile')
if pidFile:
	with open(pidFile, 'w') as f:
		f.write("%d\n" % os.getpid())

restart = False
preServer.stop()

try:
	server = getServer()
except ServerError, e:
	console('server', e.message)
	exit(1)

Cron.start()
WebSocket.start()

try:
	console('rorn', 'Listening for connections')
	try:
		server.serve_forever()
	except socket.error, e:
		if e.errno == errno.EBADF and (bricked() or '').startswith('Restart'):
			restart = True
		else:
			raise
except KeyboardInterrupt:
	sys.__stdout__.write("\n\n")
	console('main', 'Exiting at user request')
except (Exception, SystemExit), e: