Skip to content

Commit

Permalink
[circleci] tail neco-updater log.
Browse files Browse the repository at this point in the history
  • Loading branch information
morimoto-cybozu committed Jan 18, 2019
1 parent 4b05143 commit dd894b2
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 10 deletions.
15 changes: 13 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,15 @@ jobs:
command: |
./bin/watch_boot0
background: true
- run:
name: Watch neco-updater logs
command: |
./bin/watch_service neco-updater
background: true
- run:
name: Watch neco-worker logs
command: |
./bin/watch_neco_worker
./bin/watch_service neco-worker
background: true
- run:
command: |
Expand Down Expand Up @@ -120,11 +125,17 @@ jobs:
if [ ! -f .diff ]; then exit 0; fi
./bin/watch_boot0
background: true
- run:
name: Watch neco-updater logs
command: |
if [ ! -f .diff ]; then exit 0; fi
./bin/watch_service neco-updater
background: true
- run:
name: Watch neco-worker logs
command: |
if [ ! -f .diff ]; then exit 0; fi
./bin/watch_neco_worker
./bin/watch_service neco-worker
background: true
- run:
command: |
Expand Down
19 changes: 11 additions & 8 deletions bin/watch_neco_worker → bin/watch_service
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,21 @@

. $(dirname $0)/env

tail_neco_worker_once() {
test $# -eq 1
service="$1"

tail_once() {
host="$1"
$GCLOUD 2>/dev/null compute ssh --zone=${ZONE} cybozu@${INSTANCE_NAME} -- \
sudo nsenter -n -t '$(sudo pmctl pod show operation | jq .pid)' ssh -F ssh_config \
${host} journalctl -f -u neco-worker.service
${host} journalctl -f -u ${service}.service
}

tail_neco_worker() {
tail_forever() {
host="$1"

while true; do
tail_neco_worker_once $host || continue
tail_once $host || continue
sleep 3
done
}
Expand All @@ -23,9 +26,9 @@ while ! $GCLOUD 2>/dev/null compute scp --zone=${ZONE} ./dctest/dctest_key ./dct
sleep 1
done

tail_neco_worker boot-0 | sed -e s/^/$(tput -Txterm setaf 1)/ &
tail_neco_worker boot-1 | sed -e s/^/$(tput -Txterm setaf 2)/ &
tail_neco_worker boot-2 | sed -e s/^/$(tput -Txterm setaf 3)/ &
tail_neco_worker boot-3 | sed -e s/^/$(tput -Txterm setaf 4)/ &
tail_forever boot-0 | sed -e s/^/$(tput -Txterm setaf 1)/ &
tail_forever boot-1 | sed -e s/^/$(tput -Txterm setaf 2)/ &
tail_forever boot-2 | sed -e s/^/$(tput -Txterm setaf 3)/ &
tail_forever boot-3 | sed -e s/^/$(tput -Txterm setaf 4)/ &

wait

0 comments on commit dd894b2

Please sign in to comment.