try to load prefix from ENV

master
agp8x 2020-06-22 09:36:01 +02:00
parent d100f5e255
commit 1a61503eb5
2 changed files with 5 additions and 3 deletions

View File

@ -13,7 +13,7 @@ Examples:
* start services (up -d) `python3 discover.py /srv/services/ /opt/docker/testing/`
* which services are configured for autostart? `python3 discover.py -l /srv/services/ /opt/docker/testing/`
* check status `python3 discover.py -a ps /opt/docker/testing/`
* stop services `python3 discover.py -a "down -v /srv/testing/`
* stop services `python3 discover.py -a "down -v" /srv/testing/`
### pre/post exec
@ -35,4 +35,4 @@ e.g. `python3 discover.py ./sample/ -a ps --pre 'echo {path} {step}' --post './s
### pre/post exec
e.g. `python3 start.py test.lst -a ps --pre 'echo {path} {step}' --post './sample/notify_telegram.sh <telegram_bot_key> <telegram_room> {path} {cmd} {returncode} \n {stdout}'`
e.g. `python3 start.py test.lst -a ps --pre 'echo {path} {step}' --post './sample/notify_telegram.sh <telegram_bot_key> <telegram_room> {path} {cmd} {returncode} \n {stdout}'`

View File

@ -62,6 +62,8 @@ if __name__ == "__main__":
if args.key:
PREFIX = args.key
else:
PREFIX = os.getenv('DISCOVER_PREFIX', PREFIX)
services = find_services(args.service_dir)
autostarts = find_autostart_services(services)
if args.list:
@ -70,4 +72,4 @@ if __name__ == "__main__":
else:
import start
for service in autostarts:
start.change_service(service, args.action, pre_cmd=args.pre, post_cmd=args.post)
start.change_service(service, args.action, pre_cmd=args.pre, post_cmd=args.post)