Sponsored Content
Top Forums Shell Programming and Scripting Prevent file from being mailed multiple times from a job Post 302096200 by RTM on Tuesday 14th of November 2006 10:42:21 AM
Old 11-14-2006
You could, when you mail the file, move it to file.old and then in the next run, if there is a file.old, compare it to the new file that is just made. If they are the same, don't mail it. If they are different, add the new changes to the file.old and send/mail the new changes and then move the new one to file.old. This way, you don't lose any info that needs to be corrected, the users will be getting data that is new.

Once you have a run with no changes (zero bytes), you could remove file.old for future runs.
 

10 More Discussions You Might Find Interesting

1. AIX

Locking a file when using VI to prevent multiple-edit sessions by diff users

At the office, we often have to edit one file with VI. We are 4-6 workers doing it and sometimes can be done at the same time. We have found a problem and want to prevent it with a file lock. Is it possible and how ? problem : Worker-a starts edit VI session on File-A at 1PM Worker-b... (14 Replies)
Discussion started by: Browser_ice
14 Replies

2. Shell Programming and Scripting

How pull the Data from the file and should be mailed

Hi All, I need to pull the data from a file from 2 set of directories & should be mailed. I have a code , it is failing for some reason. Do somebody correct me where my script is going wrong. Directories: 1st Set of Directory /176_PS/Transactions/**/syslog.log ** : prd1 prd2... (2 Replies)
Discussion started by: raghunsi
2 Replies

3. Shell Programming and Scripting

Output section of file between two expressions multiple times

Attached is the exact ouput of a vmware VDR log file I am working with but what I am trying to achieve is as follows: I need to output sections of the file using the string "Normal backup" as the start and "Duration" as the end to seperate files so I can then manipulate them further to create... (2 Replies)
Discussion started by: jelloir
2 Replies

4. Shell Programming and Scripting

Cron job to prevent simultaneous script

I'm using a shared server on Hostgator (Linux CentOS). I'm trying to set a cron job using the Control Panel that will check if its already running before starting a new one. I've tried the following... * * * * * && but I get this error emailed to me... /bin/sh: line 0: Any... (5 Replies)
Discussion started by: tech9821
5 Replies

5. Shell Programming and Scripting

call a passwd file to a script multiple times

Hello everybody, I have a requirement in my script.. When i'am executing a script, it'll ask a passwd of some service account.. I need to pass it to the script through a zipped file when it asks for it. The script can be executed by more people many number times. So for securty purpose, it... (1 Reply)
Discussion started by: raghu.iv85
1 Replies

6. Shell Programming and Scripting

Append some text to a file multiple times

Hi, I have a text file like Version=abc Tab=1 URL GOTO=www.abc.com/board=1 some text... I want to run a loop x no of times and append to the text file above text but URL GOTO should be www.abc.com/board=2 then 3,4...etc till x. Kindly help (2 Replies)
Discussion started by: krabu
2 Replies

7. Shell Programming and Scripting

Cron to schedule job at different times

Hi, I want to run cron scheduler to run some script at different times of the day.But these times don't have some fix intervals. So how we can run jobs at 6:30AM, 1:00PM and 4:30PM everyday. Please help. Thanks Neeraj (2 Replies)
Discussion started by: apjneeraj
2 Replies

8. UNIX for Dummies Questions & Answers

copying same file multiple times with different names

hi, I am copying a file from 1 folder to another in /bin/sh. if the file already exists there, it should get copied as filename1. again if copying next time it shouldget copied as filename2.. , filename3..so on.. The problem is i am able to get uptil filename1.. but how do i know what... (6 Replies)
Discussion started by: blackcat
6 Replies

9. UNIX for Dummies Questions & Answers

How to check if the same file exists multiple times?

Hi Team , Is there a way I can check to see if the same file say , test.dat exists multiple times in the directory path ? Please help. Thanks Megha (5 Replies)
Discussion started by: megha2525
5 Replies

10. UNIX for Dummies Questions & Answers

Replace string and create new file multiple times

First of all, apologies if this has already been answered elsewhere. I haven't quite been able to find what I'm looking for yet, so hopefully this won't come across as repetition. I have a file consisting of ~100 nearly identical lines, each of which contains multiple instances of the string I... (11 Replies)
Discussion started by: pseudo.seppuku
11 Replies
LPQ(1)							    BSD General Commands Manual 						    LPQ(1)

NAME
lpq -- spool queue examination program SYNOPSIS
lpq [-al] [-P printer] [-w maxwait] [job# ...] [user ...] DESCRIPTION
lpq examines the spooling area used by lpd(8) for printing files on the line printer, and reports the status of the specified jobs or all jobs associated with a user. lpq invoked without any arguments reports on any jobs currently in the queue. Options: -P Specify a particular printer, otherwise the default line printer is used (or the value of the PRINTER variable in the environment). All other arguments supplied are interpreted as user names or job numbers to filter out only those jobs of interest. -l Information about each of the files comprising the job entry is printed. Normally, only as much information as will fit on one line is displayed. -a Report on the local queues for all printers, rather than just the specified printer. -w maxwait Specify the maximum time to wait in seconds for remote responses. The default is 300 seconds or 5 minutes. For each job submitted (i.e. invocation of lpr(1)) lpq reports the user's name, current rank in the queue, the names of files comprising the job, the job identifier (a number which may be supplied to lprm(1) for removing a specific job), and the total size in bytes. Job ordering is dependent on the algorithm used to scan the spooling directory and is supposed to be FIFO (First in First Out). File names comprising a job may be unavailable (when lpr(1) is used as a sink in a pipeline) in which case the file is indicated as ``(standard input)''. If lpq warns that there is no daemon present (i.e. due to some malfunction), the lpc(8) command can be used to restart the printer daemon. ENVIRONMENT
If the following environment variable exists, it is used by lpq: PRINTER Specifies an alternative default printer. FILES
/etc/printcap To determine printer characteristics. /var/spool/output/* The spooling directory, as determined from printcap. /var/spool/output/*/cf* Control files specifying jobs. /var/spool/output/*/lock The lock file to obtain the currently active job. DIAGNOSTICS
Unable to open various files. The lock file being malformed. Garbage files when there is no daemon active, but files in the spooling direc- tory. SEE ALSO
lpr(1), lprm(1), lpc(8), lpd(8) HISTORY
lpq appeared in 3BSD. BUGS
Due to the dynamic nature of the information in the spooling directory lpq may report unreliably. Output formatting is sensitive to the line length of the terminal; this can results in widely spaced columns. BSD
April 28, 1995 BSD
All times are GMT -4. The time now is 06:52 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy