Published: 30 May 2018 › Updated: 30 May 2018
프로그램 감시하다가 다운되면 다시 살리는 쉘 스크립트
깃 허브에도 올라가 있는데, 이전에 소개드린 바이넨스 자동 매매 프로그램이 죽었을 때 다시 살리는 쉘 스크립트입니다.
https://github.com/llejo3/binance-trading/blob/master/tradingMonitor.sh
#!/bin/bash
log=./logs/monitor.log
SLEEP_SECONDS=300 # 대기 시간
BASIC_GAP_SECONDS=300 # 비교를 위한 기준 간격 시간
while [ 1 ]
do
# 로그가 1분정도마다 남기게 되어 있어서 INFO로 남긴 데이터 중에서 마지막 시간을 가져온다.
last_date=`tail -200 ./logs/process.log | grep INFO | tail -1 | cut -c 2-20`
diff_seconds=$(($(date -d now +%s) - $(date -d "$last_date" +%s)))
if [ $diff_seconds -gt $BASIC_GAP_SECONDS ] # 로그가 없으면 다시 실행
then
# process ID를 구한다음 프로세스를 종료시킨 다음 다시 시작한다.
PROCESS=`ps -ef|grep process|grep -v grep | awk '{print $2}'`
kill -9 $PROCESS
wait
now_date=`date '+%Y-%m-%d %H:%M:%S'`
echo "$now_date : Process restarted." >> $log
./startProcess.sh
wait
fi
sleep $SLEEP_SECONDS
done
Leave 프로그램 감시하다가 다운되면 다시 살리는 쉘 스크립트 to:
Read more #monitor posts
Best Posts From southman
We have not curated any of south-man's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.
More Posts From southman
- Image of airplane, car, bicycle Deep learning source
- 비행기, 자동차, 자전거의 이미지 딥러닝 소스
- 구글이미지 다운로드하는 파이썬 라이브러리
- 프로그램 감시하다가 다운되면 다시 살리는 쉘 스크립트
- Tensorflow source to classify CIFAR 10 data
- CIFAR 10 데이터로 딥러닝하는 Tensorflow 소스
- 오직 선을 행함과 서로 나누어 주기를 잊지말라
- Binance automatic trading program v2
- 바이낸스 자동매매 하는 프로그램 v2
- Source that deep learning with mnist data