automated shell script
- From: "sappi" <swapnareddy_09@xxxxxxxxx>
- Date: 14 Jun 2006 11:28:52 -0700
Hi,
Can any one help me out in writing a shell script as i am new to
scripting.
The requirement is that i want to check for paticular file names
whether they exist or not in a directory and then if it exists, then it
should mail to a person the file names, else if it does not exist, then
it should mail to another person saying that 'file name does not exist.
Added to this it should check for different file names on different
weekdays.
eg:
if it is monday, check for file_1.txt and file_2.txt in a directory
and if exist ,mail the file names to a person.(the file name is
recognised by a sysdate on it) else mail to another person.
if it is tuesday, check for filname_3.txt and filename4.txt ........
....
I tried to write the script, and this is what i have done so far(built
the concept but with no syntax)
###using today
DAY1=`TZ=GMT+6 /usr/bin/date +%Y%m%d`
echo $DAY1
# using today - 1 (yesterday's date) in YYMMDD format
DAY2=`TZ=GMT+30 /usr/bin/date +%Y%m%d`
export YYYYMMDD
echo $YYYYMMDD
Today = F$cvtime("today",,"weekday")
if today .eqs. "Monday" then goto monday
if today .eqs. "Tuesday" then goto tuesday
if today .eqs. "Wednesday" then goto wednesday
if today .eqs. "Thursday" then goto thursday
if today .eqs. "Friday" then goto friday
go to weekend
Monday:
if [ -e filename.txt ]
then
such and such
fi
exit
Tuesday:
......
...
exit
Wednesday:
.....
exit
Thursday:
exit
Friday:
exit
Weekend:
exit
Is this concept correct by any means.
Thanks,
Sapna
.
- Follow-Ups:
- Re: automated shell script
- From: Stephane CHAZELAS
- Re: automated shell script
- From: Shivanischal
- Re: automated shell script
- From: Chris F.A. Johnson
- Re: automated shell script
- Prev by Date: Re: sed command to extract 254 from VARCHAR(254)
- Next by Date: untar a mainframe file in unix
- Previous by thread: sed command to extract 254 from VARCHAR(254)
- Next by thread: Re: automated shell script
- Index(es):
Relevant Pages
|