please check this script.


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting please check this script.
# 1  
Old 07-26-2007
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 [ ${i} -le ${#logs[*]} ]
do

find /home/logs -name "*"\${logs[i]}"\*.log" -mtime ${l
time[i]} -type f -ls

let i=$i+1

done
# 2  
Old 07-26-2007
Replace:
set i=1
by:
i=1
# 3  
Old 08-01-2007
Thx for your help!,


can you help me to this script.i am getting following error

find: incomplete statement
AA.log BB.log
-7
find: incomplete statement


set -A logs AA BB

set -A ltime 7 7

i=0

while [ ${i} -lt ${#logs[*]} ]
do
log_name="*${logs[i]}*.log"
echo $log_name

hist_days="-${ltime[i]}"
echo $hist_days

find / -print -type f -name "$log_name" -mtime "$hist_days" -exec rm -f {}/ > /home/a.log

let i=$i+1

done
# 4  
Old 08-01-2007
try this:

Code:
find / -print -type f -name "$log_name" -mtime "$hist_days" -exec rm -f {} \; > /home/a.log

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. Programming

Check This Script

Hi guys, I am sending the script i created..plzzz check it correct if any mistakes...:). 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... (0 Replies)
Discussion started by: apple2685
0 Replies

5. 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

6. 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

7. 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

8. 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

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