Check This Script


 
Thread Tools Search this Thread
Top Forums Programming Check This Script
# 1  
Old 05-16-2011
Java Check This Script

Hi guys,

I am sending the script i created..plzzz check it correct if any mistakes...Smilie.

Plz reply early by today..

here i want to find the files based on date , if files are avaliable i want to send a mail to the user. here there are a total of 43 files. they are constant.

Here is the script..

#!/bin/sh
Date=$(date +"%y%m%d")
find /stage_area/loadfiles/telsims/test/ -type f -name "*$Date" -print > /tmp/testfile.txt

returncode=$? # check here is it right to use like this
if [ $returncode != 0 ]; then

echo " Files are not avaliable"
exit $?

else

# Echo $?
temp=`cat /tmp/testfile.txt`
i = 0

for x in $temp
# echo $?
# Reads the test file and counts the number of lines ie associated to i.
do
i =` expr $i + 1 ` # for each line i increments
#echo $?
done
if [ $i == 43 ]
then # checking the condition that all file are avaliable or not
echo "Files Avalaible You can Start Your Process Now" | mailx -s "File Found" xyz@domain.com
# If condition trues sends an email to the user.
rm -rf /tmp/testfile.txt # removing the test file.
break
fi
fi

Moderator's Comments:
Mod Comment Double post, continued here

Last edited by pludi; 05-16-2011 at 04:53 AM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Script to check if files are being sent

SunOS -s 5.10 Generic_147440-04 sun4u sparc SUNW,SPARC-Enterprise Hi, on one system there are folders which are being created based on today's date /data/CDR/sswitch_roa/voice/bkup/<yyyymmdd> (e.g /data/CDR/sswitch_roa/voice/bkup/20180620 – is the path for today’s... (1 Reply)
Discussion started by: roshanbi
1 Replies

2. Shell Programming and Scripting

Script to check server-name and come out

Hello, I am not efficient in script, so need some help to create a small script. I have file, which have list of all IPs. All those IPs can be connected from a gateway server with "sudo ssh 10.63.xx.xx". We do not have reverse lookup for IPs, so I want script to login to each server, return... (1 Reply)
Discussion started by: solaris_1977
1 Replies

3. Shell Programming and Scripting

Bash shell script to check if script itself is running

hi guys we've had nagios spewing false alarm (for the umpteenth time) and finally the customer had enough so they're starting to question nagios. we had the check interval increased from 5 minutes to 2 minutes, but that's just temporary solution. I'm thinking of implementing a script on the... (8 Replies)
Discussion started by: hedkandi
8 Replies

4. Shell Programming and Scripting

script to check if another script is running and if so, then sleep for sometime and check again

Hi, I am a unix newbie. I need to write a script to check wheteher another script is still running. If it is, then sleep for 30m and then check again if the script is running. If the script has stopped running then, I need to come out of the loop. I am using RHEL 5.2 (2 Replies)
Discussion started by: mathews
2 Replies

5. Shell Programming and Scripting

perl script to check if empty files are created and delete them and run a shell script

I have a local linux machine in which the files are dumped by a remote ubuntu server. If the process in remote server has any problem then empty files are created in local machine. Is there any way using perl script to check if the empty files are being created and delete them and then run a shell... (2 Replies)
Discussion started by: hussa1n
2 Replies

6. Shell Programming and Scripting

IP check with shell script

hi guys ..newbie here i would like to create a simple script tat will detect wether the machine has IP or not ... but it seems that my script doesnt really work it kept rebooting... i set this script during boot so that it will check else it will reboot it a shell script thou... ... (5 Replies)
Discussion started by: bladez
5 Replies

7. Shell Programming and Scripting

looking for help with a dd loop check script

Hi Can anyone please help with the following script I need - .ksh preferably? I have external disks attached to a system that I have to label and then run the dd command on all external disk found. I have kicked off the dd command as follows manually to see what its output is like first... (1 Reply)
Discussion started by: angusyoung
1 Replies

8. Shell Programming and Scripting

please check this script.

please check this script and let me know.wher eis the issue. #!/bin/ksh set -A logs AAA BB CCC DDD EE FFF set -A ltime 7 60 7 7 7 60 set i=1 while } ] do find /home/logs -name "*"\${logs}"\*.log" -mtime ${l time} -type f -ls let i=$i+1 done (3 Replies)
Discussion started by: sab_sree
3 Replies

9. Shell Programming and Scripting

check in unix shell script so that no one is able to run the script manually

I want to create an automated script which is called by another maually executed script. The condition is that the no one should be able to manually execute the automated script. The automated script can be on the same machine or it can be on a remote machine. Can any one suggest a check in the... (1 Reply)
Discussion started by: adi_bang76
1 Replies

10. UNIX for Dummies Questions & Answers

Script to check for a file, check for 2hrs. then quit

I wish to seach a Dir for a specific file, once the file is found i will perform additional logic. If the file is not found within two hours, i would like to exit. Logically, I'm looking for the best way to approach this Thanks for any assistance in advance. Note: I'm using a C shell and... (2 Replies)
Discussion started by: mmarsh
2 Replies
Login or Register to Ask a Question