| 
       
       
             | 
              | 
            
            
            
              
             
             
               
               
               
                  | 
                 
UGU: Unix Guru Universe - Unix Tip #4343- January 31, 2025
 -  Home : Help
 : Today's Tip
 Unix Tip #4343- January 31, 2025
 
RUN DAILY WITH AT  
  
  
UNIX provides a command called "at"  
which can be used to run jobs according  
to the specfied time.  
  
To run a particular job in every hour,  
every day use the following set of  
commands in a file called "at.sh" which  
will be executed recursively everyday.  
  
########### 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 ##################  
 NOTE: All tips provided are USE AT YOUR OWN RISK. Tips are submitted
by various unix admins around the globe. UGU suggest you read and
test each tip in a non-volitile environment before placing into
production.
  
LAST 5 TIPS
 4342
 - FIND THOSE HIDDEN FILES
 4341
 - RUN ON LAST SUNDAY
 4340
 - SIMPLE MASK OVERLOOKED
 4339
 - AUTO WORD COMPLETION
 4338
 - CHANGE THE SUFFIX
 
I want to 
 SUBSCRIBE
 and get a UGU Tip everyday. 
I want to 
 UNSUBSCRIBE
 and NOT get a UGU Tip everyday.
 
If you have a UNIX TIP let us know, we just may use it:
(All tips become the property of the Unix Guru Universe)
                 
                  | 
                
                
                | 
                
               
                 |   | 
                
               
                   Copyright 1994-2024 Unix Guru Universe    | 
                
                
                | 
              
              
              | 
              | 
            
            
           
             |