def _run_daemon(config,app): tac = get_service_tac(app) pidfile = get_service_pid(app) with open(tac,'wb') as tfs: tfs.write(iconfig.echo_app_tac(app)) shell.run('twistd -y %s -l %s --pidfile=%s'%(tac,get_service_log(config,app),pidfile), raise_on_fail=True)
def _run_daemon(config, app): tac = get_service_tac(app) pidfile = get_service_pid(app) with open(tac, 'wb') as tfs: tfs.write(iconfig.echo_app_tac(app)) shell.run('twistd -y %s -l %s --pidfile=%s' % (tac, get_service_log(config, app), pidfile), raise_on_fail=True)
def run_live_system_init(): if not sys.platform.startswith("linux"): return from toughradius.tools import livecd # create database shell.run('echo "create database toughradius DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;" | mysql') # setup mysql user and passwd shell.run( "echo \"GRANT ALL ON toughradius.* TO radiusd@'127.0.0.1' IDENTIFIED BY 'root' WITH GRANT OPTION;FLUSH PRIVILEGES;\" | mysql" ) shell.run("mkdir -p /var/toughradius/log") shell.run("mkdir -p /var/toughradius/data") with open("/etc/radiusd.conf", "wb") as ef: ef.write(livecd.echo_radiusd_cnf()) with open("/var/toughradius/privkey.pem", "wb") as ef: ef.write(livecd.echo_privkey_pem()) with open("/var/toughradius/cacert.pem", "wb") as ef: ef.write(livecd.echo_cacert_pem()) shell.run("toughctl --initdb") if not os.path.exists("/etc/init.d/radiusd"): with open("/etc/init.d/radiusd", "wb") as rf: rf.write(livecd.echo_radiusd_script()) shell.run("chmod +x /etc/init.d/radiusd") shell.run("update-rc.d radiusd defaults") shell.run("/etc/init.d/radiusd start", raise_on_fail=True)
def run_live_system_init(): from toughradius.tools import livecd # create database shell.run( "echo \"create database toughradius DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;\" | mysql" ) # setup mysql user and passwd shell.run( "echo \"GRANT ALL ON toughradius.* TO radiusd@'127.0.0.1' IDENTIFIED BY 'root' WITH GRANT OPTION;FLUSH PRIVILEGES;\" | mysql" ) shell.run("mkdir -p /var/toughradius/log") shell.run("mkdir -p /var/toughradius/data") with open("/etc/radiusd.conf", 'wb') as ef: ef.write(livecd.echo_radiusd_cnf()) with open("/var/toughradius/privkey.pem", 'wb') as ef: ef.write(livecd.echo_privkey_pem()) with open("/var/toughradius/cacert.pem", 'wb') as ef: ef.write(livecd.echo_cacert_pem()) shell.run("toughctl --initdb") if not os.path.exists("/etc/init.d/radiusd"): with open("/etc/init.d/radiusd", 'wb') as rf: rf.write(livecd.echo_radiusd_script()) shell.run("chmod +x /etc/init.d/radiusd") shell.run("update-rc.d radiusd defaults") shell.run("/etc/init.d/radiusd start", raise_on_fail=True)