Skip to content

Commit

Permalink
Merge pull request #31 from CSPCLAB/fix/monitor
Browse files Browse the repository at this point in the history
Fix/monitor
  • Loading branch information
ljy2855 authored Mar 21, 2024
2 parents 45ec18f + 7a61566 commit 169f188
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions .github/workflows/deploy_monitor.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
name: Server Monitoring

on:
schedule:
# 매일 UTC 시간 기준 00:00에 실행 (현지 시간에 맞게 조정해야 할 수 있음)
- cron: '0 0 * * *'
# on:
# schedule:
# # 매일 UTC 시간 기준 00:00에 실행 (현지 시간에 맞게 조정해야 할 수 있음)
# - cron: '0 0 * * *'

workflow_dispatch:
# workflow_dispatch:

jobs:
monitor:
runs-on: ubuntu-latest

runs-on: ubuntu-20.04
steps:
- name: Check Bash Location
run: |
which bash
echo $SHELL
ls -l /bin/bash
ls -l /usr/bin/bash
- name: Check Server Status
uses: appleboy/ssh-action@master
with:
Expand All @@ -21,8 +26,8 @@ jobs:
port: ${{ secrets.PORT }}
script: |
echo "Checking Docker containers status..."
cd ${{secrets.PATH}}
FAILED_CONTAINERS=$(docker-compose -f docker-compose.yml ps -q | xargs docker inspect --format '{{if not .State.Running}} {{.Name}} {{end}}')
cd ${{secrets.PATH}} || exit 1
FAILED_CONTAINERS=$(docker-compose -f docker-compose.yml ps -q | xargs -r docker inspect --format '{{if not .State.Running}} {{.Name}} {{end}}')
if [ -n "$FAILED_CONTAINERS" ]; then
echo "These containers are not running:$FAILED_CONTAINERS"
exit 1
Expand Down

0 comments on commit 169f188

Please sign in to comment.