RODANDO DIARIAMENTE COM O AT

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

UNIX GURU UNIVERSE DICA UNIX

Dica Unix 2680 - 05 de maio de 2007 http://www.ugu.com/sui/ugu/show?tip.today

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

RODANDO DIARIAMENTE COM O AT

O UNIX provém um comando chamado “at” que pode ser utilizado para rodar jobs em horas especificadas.

Para rodar um job em qualquer hora, todos os dias utilize o seguinte conjunto de comando chamado “at.sh” para ser rodado recursivamente todos os dias. ########### CUT HERE ##################

#! /usr/bin/sh

dt is a variable used to store

current date

dt=date | cut -c5-10

tm is a variable used to store

current time

tm=date | cut -c12-13

while [ $tm -le 23 ] do

“at” is the command ad -f is the

option used to execute a specified

file. “file Name” should be an

executable file.

at -f ./“file Name” $tm $dt tm=expr $tm + 1 done

With out manual intervention, automatic

change over to the next day’s job

scheduling

at -f ./“File Name” 2358 $dt dt=expr $dt + 1 at -f ./at.sh 0002 $dt

########### CUT HERE ##################


Para assinar: http://www.ugu.com/sui/ugu/show?tip.subscribe Para sair: http://www.ugu.com/sui/ugu/show?tip.unsubscribe Para enviar uma dica: http://www.ugu.com/sui/ugu/show?tip.today

=============================================== DECLARAÇÃO: TODAS AS DICAS DE UNIX SÃO PROPIEDADE DA UNIX GURU UNIVERSE E NÃO SÃO PARA SER VENDIDAS, IMPRESSAS OU USADAS SEM O CONSENTIMENTO POR ESCRITO DA UNIX GURU UNIVERSE. TODAS AS DICAS SÃO “USADAS POR SEU PROPIO RISCO”. UGU ADVERTE PARA TESTAR TODAS AS DICAS EM UM AMBIENTE QUE NÃO ESTEJA EM PRODUÇÃO.

Unix Guru Universe - www.ugu.com - tips@ugu.com - Copyright 1994-2007 =========================================================================