Update start.py
This commit is contained in:
committed by
GitHub
parent
d856b0eed4
commit
ed830d713d
28
start.py
28
start.py
@@ -131,17 +131,17 @@ services:
|
|||||||
cap_add:
|
cap_add:
|
||||||
- NET_ADMIN
|
- NET_ADMIN
|
||||||
""")
|
""")
|
||||||
|
def main():
|
||||||
|
start_operation = not (args.stop or args.restart)
|
||||||
|
|
||||||
start_operation = not (args.stop or args.restart)
|
if args.build and not os.path.isfile("./Dockerfile"):
|
||||||
|
|
||||||
if args.build and not os.path.isfile("./Dockerfile"):
|
|
||||||
puts("This is not a clone of firegex, to build firegex the clone of the repository is needed!", color=colors.red)
|
puts("This is not a clone of firegex, to build firegex the clone of the repository is needed!", color=colors.red)
|
||||||
exit()
|
exit()
|
||||||
|
|
||||||
if args.threads < 1:
|
if args.threads < 1:
|
||||||
args.threads = multiprocessing.cpu_count()
|
args.threads = multiprocessing.cpu_count()
|
||||||
|
|
||||||
if start_operation and (not args.build or args.keep):
|
if start_operation and (not args.build or args.keep):
|
||||||
if check_if_exists("docker ps --filter 'name=^firegex$' --no-trunc | grep firegex"):
|
if check_if_exists("docker ps --filter 'name=^firegex$' --no-trunc | grep firegex"):
|
||||||
if args.keep:
|
if args.keep:
|
||||||
write_compose()
|
write_compose()
|
||||||
@@ -153,8 +153,8 @@ if start_operation and (not args.build or args.keep):
|
|||||||
puts(" will start on port ", end="")
|
puts(" will start on port ", end="")
|
||||||
puts(f"{args.port}", color=colors.cyan)
|
puts(f"{args.port}", color=colors.cyan)
|
||||||
|
|
||||||
psw_set = None
|
psw_set = None
|
||||||
if start_operation:
|
if start_operation:
|
||||||
if args.psw_no_interactive:
|
if args.psw_no_interactive:
|
||||||
psw_set = args.psw_no_interactive
|
psw_set = args.psw_no_interactive
|
||||||
elif not args.startup_psw:
|
elif not args.startup_psw:
|
||||||
@@ -168,10 +168,10 @@ if start_operation:
|
|||||||
else:
|
else:
|
||||||
break
|
break
|
||||||
|
|
||||||
write_compose(psw_set)
|
write_compose(psw_set)
|
||||||
|
|
||||||
sep()
|
sep()
|
||||||
if not args.no_autostart:
|
if not args.no_autostart:
|
||||||
try:
|
try:
|
||||||
if args.restart:
|
if args.restart:
|
||||||
puts("Running 'docker-compose restart'\n", color=colors.green)
|
puts("Running 'docker-compose restart'\n", color=colors.green)
|
||||||
@@ -188,6 +188,12 @@ if not args.no_autostart:
|
|||||||
finally:
|
finally:
|
||||||
if not args.keep:
|
if not args.keep:
|
||||||
os.remove(composefile)
|
os.remove(composefile)
|
||||||
else:
|
else:
|
||||||
puts("Done! You can start/stop firegex with docker-compose up -d --build", color=colors.yellow)
|
puts("Done! You can start/stop firegex with docker-compose up -d --build", color=colors.yellow)
|
||||||
sep()
|
sep()
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
try:
|
||||||
|
main()
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
print()
|
||||||
|
|||||||
Reference in New Issue
Block a user