def set_sskey(): u = current_user u.sskey = request.forms.get('sskey') u.write() import cron; cd = cron.start() if cd <= 0.5: msg = "Your Shadowsocks key is changed!" else: msg = "The Shadowsocks key will be changed in %.2f sec" % cd return get_home_content(msg)
def updateServer(): if (current_user.id != config.USER_ADMIN): return redirect('/') import cron cd = cron.start() msg = "The Shadowsocks will be updated in %.2f sec" % cd return template('home', config=config, user=current_user, message=msg, users=user.get_all())
def set_sskey(): u = current_user u.sskey = request.forms.get('sskey') u.write() import cron cd = cron.start() if cd <= 0.5: msg = "Your Shadowsocks key is changed!" else: msg = "The Shadowsocks key will be changed in %.2f sec" % cd return get_home_content(msg)
def updateServer(): if (current_user.id != 0): return redirect('/') import cron; cd = cron.start() msg = "The Shadowsocks will be updated in %.2f sec" % cd return template( 'home', config=config, user=current_user, message=msg, users=user._USER_CACHE )
def sskey(): sskey = request.forms.get('sskey') u = current_user if (u.id == 0): u = user.open(request.forms.get('username')) u.sskey = sskey u.write() import cron; cd = cron.start() if cd <= 0.5: msg = "Your Shadowsocks key is changed!" else: msg = "The Shadowsocks key will be changed in %.2f sec" % cd return template( 'home', config=config, user=current_user, message=msg, users=(user._USER_CACHE if current_user.id == 0 else {}) )
def __main__(): cron.start(timeToSearchAlarms) print('Inicie Servicio') app.run(host='0.0.0.0')
def cron_start(): print('Iniciando Cron') cron.start(timeToSearchAlarms)
def admin_restart(): import cron cd = cron.start() return { "time": cd }
port = int(config['server']['port']) nick = config['server']['nick'] username = config['server']['username'] realname = config['server']['realname'] channels = config['server']['channels'].split() server = Server(host = host, port = port, nick = nick, username = username, realname = realname, channels = channels) return config, server if __name__ == '__main__': config, server = read_config() botcmd.initialize(config = config) cron_control_channel = cron.start() logging_channel, dead_notify_channel = spawn_loggerthread() control_channel = spawn_serverthread(server, cron_control_channel, logging_channel) while True: message = dead_notify_channel.recv(blocking = False) if message is not None: if message[0] == controlmessage_types.quit: break cmd = input('') if cmd == 'q': print('Keyboard quit') control_channel.send((controlmessage_types.quit,)) logging_channel.send((logmessage_types.internal, internal_submessage_types.quit)) cron.quit(cron_control_channel)
import cron # Comment below line if you want to delete the Cron Job cron.start() # Uncomment below line if you want to delete the Cron Job # cron.stop()
def admin_restart(): import cron cd = cron.start() return {"time": cd}