viernes, 30 de marzo de 2012

simple_cron.sh



#!/bin/bash
inicio="19:43"
fin="6:50"

cmd="transmission-gtk"

while true;do
    hora=`date +"%k:%M"`
    echo $hora
    if [ $hora = $inicio ] ; then
            echo ejecutando cmd
            $cmd &
    fi
    if [ $hora = $fin ] ; then
            echo fin cmd
            killall -S INT $cmd
    fi
    echo esperando 60 segundos
    sleep 60
done
exit

(c) fagervan at gmail

No hay comentarios: