Check for files and log report if missing


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Check for files and log report if missing
# 1  
Old 11-19-2008
Bug Shell script that checks for a file and reports if missing

Hi,

I need a shell program that will prompt the user to input a dept name to the script.
The script should then check a specific directory called ‘report' in the home directory of each member of that dept.
If the report directory does not exist, or there are no contents in the directory, that user's name should be stored in a file called ‘logfile' in the current directory. The first line in logfile should contain a header ‘List of users with no reports on ‘today's date and time' ‘
Otherwise the contents of the directory should be copied to a sub directory called ‘reporting' in the current directory.
The script should repeat the process until all users in the dept have been checked.

Thanks,
Johnny

Last edited by johnnyvlme; 11-19-2008 at 12:56 PM..
# 2  
Old 11-19-2008
what have you done so far...

where is it failing...
# 3  
Old 11-19-2008
I'm a Unix novice so I haven't really done much...Smilie


echo -e "Please enter the dept name: \c"
read classname


# parse the /etc/group file to extract username, found in forth field
groupnum=`cat /etc/group/ | grep $classname | cut -f4 -d:`

# need to pass this info to the /etc/passwd file to check users home directory for the 'report' file
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Bash to check directory and create missing folder from file

In the below bash I am trying to ensure that all folders (represented by $folders) in a given directory are created. In the file f1 the trimmed folder will be there somewhere (will be multiple trimmed folders). When that trimmed folder is found (represented by $S5) the the contents of $2 printed... (19 Replies)
Discussion started by: cmccabe
19 Replies

2. Shell Programming and Scripting

Check/print missing number in a consecutive range and remove duplicate numbers

Hi, In an ideal scenario, I will have a listing of db transaction log that gets copied to a DR site and if I have them all, they will be numbered consecutively like below. 1_79811_01234567.arc 1_79812_01234567.arc 1_79813_01234567.arc 1_79814_01234567.arc 1_79815_01234567.arc... (3 Replies)
Discussion started by: newbie_01
3 Replies

3. Shell Programming and Scripting

To check the missing file based on sequence number.

Hi All, I have a requirement that i need to list only the missing sequences with a unix script. For Example: Input: FILE_001.txt FILE_002.txt FILE_005.txt FILE_006.txt FILE_008.txt FILE_009.txt FILE_010.txt FILE_014.txt Output: FILE_003.txt FILE_004.txt FILE_007.txt FILE_011.txt... (5 Replies)
Discussion started by: Arun1992
5 Replies

4. Shell Programming and Scripting

How to check 2 log files for a common pattern?

hi! im new here and to unix. I want to do something with our log files. to compare two log files for a certain pattern. sample: file1.log contains all the "successful" run of a procedure. file2.log contains all the "current" running procedures. sample line from file1.log... (5 Replies)
Discussion started by: cabs_14
5 Replies

5. Shell Programming and Scripting

How to check missing sequence?

I want to listed files every hours and check the missing sequence my file format is CV.020220131430.txt CV.020220131440.txt CV.020220131450.txt CV.ddmmyyhhm.txt how to check if i have missing files in sequence .. thanks (3 Replies)
Discussion started by: before4
3 Replies

6. Fedora

Missing entries in log files just before/after reboot

Hello world, One of the servers, a Fedora one,rebooted today (Luckily, a testbox). I tried to get the reason the server rebooted. After going through the messages, I think that the log entries just before and after reboot are missing. Please below: (****** is the server name, for privacy... (0 Replies)
Discussion started by: satish51392111
0 Replies

7. Shell Programming and Scripting

Report missing files

Hello I need to check various directories for the existence of files. If a file or more are missing I need to display it: e.g files in a dir: data_file.11032300.Z data_file.11032301.Z data_file.11032302.Z data_file.11032303.Z data_file.11032304.Z data_file.11032305.Z... (11 Replies)
Discussion started by: drbiloukos
11 Replies

8. Shell Programming and Scripting

Compare 2 folders to find several missing files among huge amounts of files.

Hi, all: I've got two folders, say, "folder1" and "folder2". Under each, there are thousands of files. It's quite obvious that there are some files missing in each. I just would like to find them. I believe this can be done by "diff" command. However, if I change the above question a... (1 Reply)
Discussion started by: jiapei100
1 Replies

9. Shell Programming and Scripting

how to check missing files?

I have 50 files in this directory (/home/unixnewbie/wklyfiles) namely: statistics.1 statistics.2 statistics.3 statistics.4 statistics.5 statistics.6 statistics.7 statistics.8 statistics.9 statistics.10 .... statistics.20 .... statistics.50 How can i determine if ever there will be... (7 Replies)
Discussion started by: gholdbhurg
7 Replies

10. Shell Programming and Scripting

Help generate report from log files

Hi Expert, I have some confusing to generate report from the log file as shown below: filename :test1.log start_time date end_time number code P 000029.621 20070823 000029 12134567890 111111111111 00 0 000 003... (4 Replies)
Discussion started by: bucci
4 Replies
Login or Register to Ask a Question