#!/usr/bin/python3 import argparse #import subprocess import os #import server # import sys # from nitpo import Nitpo from runic import Runic desc = 'test web start via socket' parser = argparse.ArgumentParser(description=desc) # parser.add_argument('-s', action='store_true', help='stop only') args = parser.parse_args() r = Runic() curl_fufi = '/usr/bin/curl' if not os.path.isfile(curl_fufi): print(f"I don't see curl at {curl_fufi}") quit() if not r.has_conf('files','socket'): print("I need a socket file configure") quit() socket_fufi = r.conf['files']['socket'] s = f"{curl_fufi} --unix-socket {socket_fufi} http" print(s) # n = Nitpo() # # run = '/usr/bin/gunicorn --workers 1' # if not n.has_conf('files', 'socket'): # print("I need a socket file in nitpo.ini.") # quit() # socket_fufi = n.conf['files']['socket'] # if not n.has_conf('files', 'pid'): # print("I need a pid file in nitpo.ini.") # quit() # pid_fufi = n.conf['files']['pid'] # if not n.has_conf('files', 'guniconf'): # print("I need guniconf file in nitpo.ini.") # quit() # conf_fufi = n.conf['files']['guniconf'] # # logi = '--log-file /tmp/gunicorn.log --log-level debug' # kill = f"/bin/kill `/bin/cat {pid_fufi}` ; " # run += f" {logi} -c {conf_fufi} " # run += f" -D -b unix:{socket_fufi} -p {pid_fufi} " # if os.path.isfile(pid_fufi): # run = kill + " " + run # if args.s: # subprocess.run(kill, check=True, shell=True) # quit() # run += ' server:app > /dev/null' # print(run) # #try: # subprocess.run(run, check=True, shell=True)