소스 검색

mautore to automatically restart things

master
mort 8 년 전
부모
커밋
529f8d72da
1개의 변경된 파일24개의 추가작업 그리고 0개의 파일을 삭제
  1. 24
    0
      bin/mautore

+ 24
- 0
bin/mautore 파일 보기

@@ -0,0 +1,24 @@
#!/bin/bash

DIR="."
CMD="$1"

$CMD &
PID=$!

OLD=$(ls -R --full-time "$DIR")

while :; do
NEW=$(ls -R --full-time "$DIR")
if [ "$OLD" != "$NEW" ]; then
OLD=$(ls -R --full-time "$DIR")

kill -9 "$PID" > /dev/null
[ $? != "0" ] && echo "Process $PID doesn't exist."

$CMD &
PID=$!
fi

sleep 1
done

Loading…
취소
저장