Buscar en este blog

23.2.17

Demonio bash linux

Esquema de script muy sencillo para hacer un demonio en bash corriendo en background:

#!/bin/bash

# At first you have to redirect stdout and stderr to /dev/null
exec >/dev/null
exec 2>/dev/null

# Fork and go to background
(
while true; do
    echo 'hi' >> ~/hihihi
    sleep 10
done
)&
# Parent process finished but child still working


Visto en: http://stackoverflow.com/questions/41258219/how-to-daemonize-a-script