Log to a file

This commit is contained in:
Trevor Vallender 2023-09-22 14:56:19 +01:00
parent f0aead5584
commit 7e01e88b9d
1 changed files with 6 additions and 1 deletions

View File

@ -27,10 +27,15 @@ cx_ssh() {
cx_log() { cx_log() {
set_stack set_stack
OUTPUT_FILE=$(mktemp)
echo "Logging to $OUTPUT_FILE"
SERVERS=$(cx servers list --stack $APPLICATION --environment $ENVIRONMENT | grep "\[.*$ROLE.*\]" | cut -d ' ' -f1) SERVERS=$(cx servers list --stack $APPLICATION --environment $ENVIRONMENT | grep "\[.*$ROLE.*\]" | cut -d ' ' -f1)
for SERVER in ${SERVERS// /} ; do for SERVER in ${SERVERS// /} ; do
cx tail --stack $APPLICATION --environment $ENVIRONMENT $SERVER $LOG_FILE & echo "Following $LOG_FILE on $SERVER"
cx tail --stack $APPLICATION --environment $ENVIRONMENT $SERVER $LOG_FILE > ./$SERVER.log &
done done
#tail -f $OUTPUT_FILE
#pkill cx
} }
############################################################ ############################################################