Sponsored Content
Full Discussion: Check for specific files
Top Forums Shell Programming and Scripting Check for specific files Post 96935 by woosaah on Tuesday 24th of January 2006 05:37:05 PM
Old 01-24-2006
Code:
i=0
while (( i < ${#SC[*]}))
do
  set $signofffiles/scan.batchno.${SC[$i]}.03.[0-9]*.signed.off
  if [[ $# -eq 1 && -s $1 ]]
  then
     echo file from server $i is present, file name is $1
  else
     echo file from server $i is absent
  fi
        ((i = i + 1))
done

Ok i have this... There is just something wrong with the if statement. but other than that it is working. the if statement is always picking up that there is something in $1. For example if the file is not there $1 is

Code:
/home/nzbt6t/signoff/filedownload/scan.batchno.CH.03.[0-9]*.signed.off

if a file is there, and i can see it it still comes out that the file is absent all the time. can anyone see anything really obvious about this? i am sure there is.

using echo $1 and echo $# as well as the output i am getting the following:
Code:
/home/nzbt6t/signoff/filedownload/scan.batchno.EL.03.20060119.signed.off
1
file from server 0 is absent
/home/nzbt6t/signoff/filedownload/scan.batchno.HN.03.20060119.signed.off
1
file from server 1 is absent
/home/nzbt6t/signoff/filedownload/scan.batchno.VV.03.20060119.signed.off
1
file from server 2 is absent
/home/nzbt6t/signoff/filedownload/scan.batchno.CH.03.[0-9]*.signed.off
1
file from server 3 is absent
/home/nzbt6t/signoff/filedownload/scan.batchno.DN.03.20060119.signed.off
1
file from server 4 is absent

btw thanks so much for your help so far i can feel i am so close. if it is was in vb it would be so simple Smilie
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to check for specific process running through shell

Hi I want to check whether specific process is running or not through a shell script. ps -ef | grep will tell me this, i tried this way in shell cnt =`ps -ef| grep xyz | awk '{ END {print NR}}` if it return two rows, job is running else not. Is there any better way of doing this. (3 Replies)
Discussion started by: agp
3 Replies

2. Shell Programming and Scripting

check timestamp on specific files

I have a health check script homed in /u/ainet/scripts I need to check the time stamp on a file in /opt/config/log/ The file is called Backupdisk.out I want write the same info that you get when you do a ls -l into a file This is what I have been trying: cd /opt/config/log/ ls -l | awk... (2 Replies)
Discussion started by: grinds
2 Replies

3. Shell Programming and Scripting

Copying specific files from remote m/c to specific folders

Hi All, I am trying to rsync some of the latest files from remote m/c to my local linux box. Folder structure in my remote m/c looks like this /pub/Nightly/Package/ROLL/WIN /pub/Nightly/Package/SOLL/sol /pub/Nightly/Package/SOLL/linux Each of the folder contains gzip files which on daily... (0 Replies)
Discussion started by: jhoomsharabi
0 Replies

4. Shell Programming and Scripting

How to check for a specific process running or not in Unix

I have used ps -ef | grep <process name> to see if the process is still running or not. But, not being able to find anything in particular. Any clue on this... (4 Replies)
Discussion started by: Haimanti
4 Replies

5. Shell Programming and Scripting

Check a specific word whether is in file

I want to valid a specific word whether it is contained in the text file. For example: family.txt father mother son sister if ("father" contain in family.txt) do some process else do other process How shell scripting can accomplish this? Anyone can provide helps? (3 Replies)
Discussion started by: alvin0618
3 Replies

6. Shell Programming and Scripting

Request to check:count specific entries

Hi all I have an input file which contains so many entries like this: And, I want to count hw many among ASN in one column are converted to LYS in third coulmns. which means output shuld contain only "ASN number LYS" Kindly let me know wny programm for this My input is ASN 217 LYS... (2 Replies)
Discussion started by: manigrover
2 Replies

7. Shell Programming and Scripting

Perl code to check date and check files in particular dir

Hi Experts, I am checking how to get day in Perl. If it is “Monday” I need to process…below is the pseudo code. Can you please prove the code for below condition. if (today=="Monday" ) { while (current_time LESS THAN 9:01 AM) ... (1 Reply)
Discussion started by: ajaypatil_am
1 Replies

8. Shell Programming and Scripting

Check for Specific Username Password Expire

hey Guys, I haven't posted in a while, But you guys were really helpful alst time. I have had a issue with User Passwords expiring, and since I dont check /var/cron/log on the regular I never know these suers are expiring, making certain nightly jobs not run. With this script, I want to be... (14 Replies)
Discussion started by: gkelly1117
14 Replies

9. UNIX for Dummies Questions & Answers

Check for entry of specific pattern

Hey Guys and Gals, I am having trouble with what I thought shouldn't be hard.. In a script I am working on there is a need to enter a MAC address. MAC addresses are formatted ; XX:XX:XX:XX:XX:XX where X can be 0-9, a-f or A-F So in the sample script the query is something... (4 Replies)
Discussion started by: TAPE
4 Replies

10. Shell Programming and Scripting

Check first specific string after a pattern

Hi, I've a file with content as below first_block_list{ a:5 b:3 c:8 } new_store_list( a:1000 b:200 c:3343 ) first_item_list{ a:10 b:20 c:30 } second_item_list{ (1 Reply)
Discussion started by: ratheeshp
1 Replies
queuedefs(4)							   File Formats 						      queuedefs(4)

NAME
queuedefs - queue description file for at, batch, and cron SYNOPSIS
/etc/cron.d/queuedefs DESCRIPTION
The queuedefs file describes the characteristics of the queues managed by cron(1M). Each non-comment line in this file describes one queue. The format of the lines are as follows: q.[njobj][nicen][nwaitw] The fields in this line are: q The name of the queue. a is the default queue for jobs started by at(1); b is the default queue for jobs started by batch (see at(1)); c is the default queue for jobs run from a crontab(1) file. njob The maximum number of jobs that can be run simultaneously in that queue; if more than njob jobs are ready to run, only the first njob jobs will be run, and the others will be run as jobs that are currently running terminate. The default value is 100. nice The nice(1) value to give to all jobs in that queue that are not run with a user ID of super-user. The default value is 2. nwait The number of seconds to wait before rescheduling a job that was deferred because more than njob jobs were running in that job's queue, or because the system-wide limit of jobs executing has been reached. The default value is 60. Lines beginning with # are comments, and are ignored. EXAMPLES
Example 1: A sample file. # # a.4j1n b.2j2n90w This file specifies that the a queue, for at jobs, can have up to 4 jobs running simultaneously; those jobs will be run with a nice value of 1. As no nwait value was given, if a job cannot be run because too many other jobs are running cron will wait 60 seconds before trying again to run it. The b queue, for batch(1) jobs, can have up to 2 jobs running simultaneously; those jobs will be run with a nice(1) value of 2. If a job cannot be run because too many other jobs are running, cron(1M) will wait 90 seconds before trying again to run it. All other queues can have up to 100 jobs running simultaneously; they will be run with a nice value of 2, and if a job cannot be run because too many other jobs are running cron will wait 60 seconds before trying again to run it. FILES
/etc/cron.d/queuedefs queue description file for at, batch, and cron. SEE ALSO
at(1), crontab(1), nice(1), cron(1M) SunOS 5.10 1 Mar 1994 queuedefs(4)
All times are GMT -4. The time now is 08:45 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy