Explorar el Código

mautore to automatically restart things

master
mort hace 8 años
padre
commit
529f8d72da
Se han modificado 1 ficheros con 24 adiciones y 0 borrados
  1. 24
    0
      bin/mautore

+ 24
- 0
bin/mautore Ver fichero

@@ -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

Cargando…
Cancelar
Guardar