Check if firegex is already started
This commit is contained in:
committed by
GitHub
parent
c1f5887e1f
commit
37c51d6c4a
7
start.py
7
start.py
@@ -55,6 +55,7 @@ def run_checks():
|
|||||||
puts("Cannot use docker, the user hasn't the permission or docker isn't running", color=colors.red)
|
puts("Cannot use docker, the user hasn't the permission or docker isn't running", color=colors.red)
|
||||||
exit()
|
exit()
|
||||||
|
|
||||||
|
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
parser.add_argument('--port', "-p", type=int, required=False, help='Port where open the web service of the firewall', default=4444)
|
parser.add_argument('--port', "-p", type=int, required=False, help='Port where open the web service of the firewall', default=4444)
|
||||||
parser.add_argument('--threads', "-t", type=int, required=False, help='Number of threads started for each service/utility', default=-1)
|
parser.add_argument('--threads', "-t", type=int, required=False, help='Number of threads started for each service/utility', default=-1)
|
||||||
@@ -69,7 +70,6 @@ parser.add_argument('--startup-psw','-P', required=False, action="store_true", h
|
|||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
os.chdir(os.path.dirname(os.path.realpath(__file__)))
|
os.chdir(os.path.dirname(os.path.realpath(__file__)))
|
||||||
|
|
||||||
run_checks()
|
run_checks()
|
||||||
|
|
||||||
start_operation = not (args.stop or args.restart)
|
start_operation = not (args.stop or args.restart)
|
||||||
@@ -82,6 +82,9 @@ if args.threads < 1:
|
|||||||
args.threads = multiprocessing.cpu_count()
|
args.threads = multiprocessing.cpu_count()
|
||||||
|
|
||||||
if start_operation:
|
if start_operation:
|
||||||
|
if check_if_exists("docker ps --filter 'name=^firegex$' --no-trunc | grep firegex"):
|
||||||
|
puts("Firegex is already running! use --help to see options useful to manage firegex execution", color=colors.yellow)
|
||||||
|
exit()
|
||||||
sep()
|
sep()
|
||||||
puts(f"Firegex", color=colors.yellow, end="")
|
puts(f"Firegex", color=colors.yellow, end="")
|
||||||
puts(" will start on port ", end="")
|
puts(" will start on port ", end="")
|
||||||
@@ -113,6 +116,7 @@ version: '3.9'
|
|||||||
services:
|
services:
|
||||||
firewall:
|
firewall:
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
container_name: firegex
|
||||||
{"build: ." if args.build else "image: ghcr.io/pwnzer0tt1/firegex"}
|
{"build: ." if args.build else "image: ghcr.io/pwnzer0tt1/firegex"}
|
||||||
network_mode: "host"
|
network_mode: "host"
|
||||||
environment:
|
environment:
|
||||||
@@ -135,6 +139,7 @@ version: '3.9'
|
|||||||
services:
|
services:
|
||||||
firewall:
|
firewall:
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
container_name: firegex
|
||||||
{"build: ." if args.build else "image: ghcr.io/pwnzer0tt1/firegex"}
|
{"build: ." if args.build else "image: ghcr.io/pwnzer0tt1/firegex"}
|
||||||
ports:
|
ports:
|
||||||
- {args.port}:{args.port}
|
- {args.port}:{args.port}
|
||||||
|
|||||||
Reference in New Issue
Block a user