/usr/share/pyshared/jsb/lib/exit.py is in jsonbot 0.84.4-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | # jsb/exit.py
#
#
""" jsb's finaliser """
## jsb imports
from jsb.utils.locking import globallocked
from jsb.utils.exception import handle_exception
from jsb.utils.trace import whichmodule
from jsb.memcached import killmcdaemon
from jsb.lib.persist import cleanup
from jsb.lib.boot import ongae
from runner import defaultrunner, cmndrunner, callbackrunner, waitrunner
## basic imports
import atexit
import os
import time
import sys
import logging
## functions
@globallocked
def globalshutdown(exit=True):
""" shutdown the bot. """
try:
try: sys.stdout.write("\n")
except: pass
logging.error('shutting down'.upper())
from fleet import getfleet
fleet = getfleet()
if fleet:
logging.warn('shutting down fleet')
fleet.exit()
logging.warn('shutting down plugins')
from jsb.lib.plugins import plugs
plugs.exit()
logging.warn("shutting down runners")
cmndrunner.stop()
callbackrunner.stop()
waitrunner.stop()
logging.warn("cleaning up any open files")
while cleanup(): time.sleep(1)
try: os.remove('jsb.pid')
except: pass
killmcdaemon()
logging.warn('done')
if not ongae: print ""
if exit and not ongae: os._exit(0)
except Exception, ex:
print str(ex)
if exit and not ongae: os._exit(1)
|