Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
eoa-1.5/scripts/restart.py
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
executable file
52 lines (39 sloc)
956 Bytes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
from utils.settings import BASE_DIR, load_config | |
from utils.functions import run | |
import subprocess | |
import shlex | |
import os | |
from time import sleep | |
def stop( env ): | |
# run application | |
subprocess.call( | |
"docker-compose down", | |
shell=True, | |
env=env | |
) | |
if __name__ == '__main__': | |
from argparse import ArgumentParser | |
config = load_config() | |
parser = ArgumentParser( | |
description="restart the webserver" | |
) | |
parser.add_argument( | |
"--build", | |
action = "store_true" | |
) | |
parser.add_argument( | |
"CMD", | |
nargs="*" | |
) | |
args = parser.parse_args() | |
stop( config ) | |
CMD= \ | |
(vars(args)['CMD']) | |
run( | |
env=config, | |
build = args.build, | |
cmd=CMD | |
) | |
print("\n------------------------------\n") | |
print("You can view the tail of container log output with 'docker-compose logs -f' (ctrl + c to stop).") |