[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Script para xawtv



El script anterior estaba mal.
Aqui esta la version corregida y comprobada.

#####################################################
# Script creado por Pablo Martín Suárez
#############################
#!/bin/bash

MINUTO=`date +%M`
HORA=`date +%H`

if (! test -e /tmp/.sleep) ; then echo 90 > /tmp/.sleep ; fi

SLEEP_TIME=`cat /tmp/.sleep`

if (! let $SLEEP_TIME) ; then rm -f /tmp/.sleep ; fi

xawtv-remote msg $SLEEP_TIME

# Añadir entrada a cron para que apague el xawtv

if (test -e /tmp/.sleep) ; then     let MINUTO=$MINUTO+$SLEEP_TIME;
    if (let `echo $[ $MINUTO > 59 ]`) ; then
if (let `echo $[ $MINUTO > 119]` ) ; then let HORA=$HORA+1; MINUTO=$MINUTO-60; fi;
        let HORA=$HORA+1;
        let MINUTO=$MINUTO-60;
    fi

    if (let `echo $[$HORA > 23]` ) ; then let HORA=$HORA-24; fi;

let SLEEP_TIME=$SLEEP_TIME-10 ; echo $SLEEP_TIME > /tmp/.sleep ; crontab -l|grep -v sleeping > /tmp/.sleep.1; echo "$MINUTO $HORA * * * xawtv-remote quit && echo sleeping" > /tmp/.sleep.2;
    cat /tmp/.sleep.* > /tmp/.sleep.crontab ;
    crontab /tmp/.sleep.crontab;
    rm /tmp/.sleep.crontab;
else
    crontab -l|grep -v sleeping > /tmp/.sleep.crontab;
    crontab /tmp/.sleep.crontab;
    rm /tmp/.sleep.crontab
fi
#############################################




Reply to: