Sponsored Content
Top Forums Shell Programming and Scripting Send email if latest file in a directory is older than 2 hours Post 302997550 by simpltyansh on Tuesday 16th of May 2017 03:24:34 PM
Old 05-16-2017
Quote:
Originally Posted by jim mcnamara
Please tell us what UNIX you are using and what shell. In this case it makes a big difference. Linux has better date/time tools than Solaris for example. So the answer to your question will be different for different OS/shell.
Using AIX and KSH

---------- Post updated at 02:24 PM ---------- Previous update was at 08:12 AM ----------

Quote:
Originally Posted by RudiC
For just the time check, try
Code:
[ "$(find . -cmin -120)" ] || echo mail -s "subject one" recipient@url.com

For the youngest file's time stamp, your attempt should work.
Hi Rudi,

Can you help me with the complete script, I didn't get your solution.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

unix command/s to find files older than 2 hours in a directory

I need to write a script to find files older than 2 hours in set of direcotries and list them ina mail. I know find command ti list files greater/lesser than days but i need to do it for hours. Any input. (6 Replies)
Discussion started by: Presanna
6 Replies

2. AIX

how to find files older than 2 hours

I need help to find files in a directory that are older than 2 hours. Any help would be great. (3 Replies)
Discussion started by: pt14
3 Replies

3. Shell Programming and Scripting

shell script to send email with usage of space in the directory as description :

shell script to send email with usage of space in the directory as description : Please any one help me in writing a script to send email with usage of space in the directory as description . (3 Replies)
Discussion started by: sakthifire
3 Replies

4. Shell Programming and Scripting

Move the latest or older File from one directory to another Directory

I Need help for one requirement, I want to move the latest/Older file in the folder to another file. File have the datetimestamp in postfix. Example: Source Directory : \a destination Directory : \a\b File1 : xy_MMDDYYYYHHMM.txt (xy_032120101456.txt) File2: xy_MMDDYYYYHHMM.txt... (1 Reply)
Discussion started by: pp_ayyanar
1 Replies

5. Shell Programming and Scripting

Shell script: If a file stays in a particular directory more than 30 min send an email

Hi , I am new to shell scripting. i have a requirement say i will receive a file in a directory say /xyz.if that file stays in that directory more than 30 min i need to get a mail to my outlook.this should run for every 20 min in crontab. can anyone help me? (8 Replies)
Discussion started by: muraliinfy04
8 Replies

6. Shell Programming and Scripting

Script to send email after comparing the folder permissions to a certain permission & send email

Hello , I am trying to write a unix shell script to compare folder permission to say drwxr-x-wx and then send an email to my id in case the folders don't have the drwxr-x-wx permissions set for them . I have been trying to come up with a script for few days now , pls help me:( (2 Replies)
Discussion started by: nairshar
2 Replies

7. Shell Programming and Scripting

files older than few hours

Hi All I need to know the command which can be used to list the files which are 3 hours old so that it can be deleted. (3 Replies)
Discussion started by: mskalyani9
3 Replies

8. Shell Programming and Scripting

Loop multiple directory, find a file and send email

Hello ALL, need a BASH script who find file and send email with attachment. I have 50 folders without sub directories in each generated files of different sizes but with a similar name Rp01.txt Rp02.txt Rp03.txt ...etc. Each directors bound by mail group, I need a script that goes as... (1 Reply)
Discussion started by: penchev
1 Replies

9. Shell Programming and Scripting

To get older than last 7days records using awk scripting to generate report and send email

Hello All, I have need as below: 1--> I need to get all users(who submit jobs) and their details by using below command: qstat -u \* output of the above command looks line below: job-ID prior name user-id state "submit/start at" queue jclass slots ja-task-ID... (5 Replies)
Discussion started by: VasuKukkapalli
5 Replies

10. Shell Programming and Scripting

Send an email if "No such file or directory" in the shell script program log in EBS concur

Hi All, I have the below code(.sh) and need to send an email. #!/bin/bash cp /u02/xxc_incoming/TEST*.dat /u02/xxc_archive_incoming/AMER7764_ARPP_2/ cat /u02/xxc_incoming/TEST*.dat > /u02/xxc_incoming/XXC_TEST.dat rm /u02/xxc_incoming/TEST*.dat cd $XXC_TOP/bin sqlldr userid=apps/<pwd> ... (12 Replies)
Discussion started by: Mist123
12 Replies
uucleanup(8)						      System Manager's Manual						      uucleanup(8)

NAME
uucleanup - Deletes selected old files from the uucp spool directory SYNOPSIS
uucleanup [options] FLAGS
If you specify one of the following flags, you must provide a value for days. The default value listed is used if the flag is not speci- fied. Removes any C.*(Command) files as old as or older than the number of days specified by days, and sends appropriate information to the requester. The default is 7 days. The -C and -W flags cannot be combined. Removes any D.*(Data) files as old as or older than the number of days specified in days. Also attempts to deliver any remaining mail messages. The default is 7 days. Includes a specified line of text in the warning message generated by the -W flag. The default line is: We have been unable to contact machine machine_name since you queued your job. The -m flag can be used only with the -W flag. Removes files in addition to those specified by the -C, -D, and -X flags that are as old as or older than the number of days specified in days. The default is 2 days. Executes uucleanup only on the spool directory specified by system. The default is to clean up all uucp spool directories. Note that system names can contain only ASCII characters. Removes TM.* (Temporary) files as old as or older than the number of days specified by the days argument. Also attempts to deliver any remaining mail messages. The default is 7 days. Sends a mail message to the requester warning that C*. files as old as or older than the number of days specified in days are still in the spool direc- tory. The message includes the job ID and, in the case of mail, the mail message. The administrator can use the -m flag to include a message line telling who to call to check the problem. The default is 1 day. Removes any X.*(Execute) files as old as or older than the number of days specified in days. The default is 2 days. Displays debugging information on the screen of the local termi- nal; level must be an integer from 0 to 9. The higher the number, the more detailed the debugging information. DESCRIPTION
The uucleanup program removes outdated files from the spool directory /usr/spool/uucp. The uucleanup program scans the /usr/spool/uucp spool directory for old files and takes appropriate action to remove them in a useful way. The uucleanup command performs the following tasks: Informs the requester of send/receive requests for systems that cannot be reached Warns users about requests that wait more than a specified number of days (the default is 1 day) Returns mail that cannot be delivered to the sender Removes all other files older than a specified number of days from the spool directory. The uucleanup program is not usually invoked from the command line, but is executed by the shell procedure uudemon.cleanu located in /usr/lib/uucp, which in turn is started by the cron script located in /usr/adm/cron/crontabs/uucp. Only someone with superuser privileges can issue the uucleanup command from the command line. To enable automatic cleanup, edit the file /usr/adm/cron/crontabs/uucp. Remove the # (number sign) from the beginning of the uude- mon.cleanu line. EXAMPLES
To locate files, enter: # uucleanup -W2 This form of the command locates C.* (Command) files 2 or more days old and warns the requesters that the files have not been sent. To send a message with a warning, enter: # uucleanup -W2 -mContact the System Admin about these files This form of the command locates C.* (Command) files 1 or more days old (the default), warns requesters their files have not been sent, and gives them the message: Contact the System Admin about these files. To clean up command files that are 8 or more days old, enter: # uucleanup -C8 This form of the command removes all C.* (Command) files 8 or more days old and sends an appropriate message to the requesters. Other uucp spool files are removed based on the default value for that type. To clean up data and execute files, enter: # uucleanup -D7 -X3 This form of the command removes all D.* (Data) files 7 or more days old (the default) and all X.* (Execute) files older than 3 days and attempts to deliver all undelivered mail. Remaining uucp spool files are removed based on the default value for that type. To clean up other files, enter: # uucleanup -o2 This form of the command removes uucp spool files according to their default values except for other files, which are removed if 2 days or older. To clean up all files at once, enter the command without flags: # uucleanup This form of the command removes all C.*, D.*, and X.* files, and all other files older than the default times. To clean up files for system hera, enter: # uucleanup -shera -C5 This form of the command removes all C.* files 5 or more days old and the other uucp spool files according to their default files for system hera (the files are in /usr/spool/uucp/hera/*). FILES
Specifies the command path. File that starts uudemon.cleanu shell procedure. Contains all the configuration files for uucp, and the uude- mon.cleanu shell procedure. Schedules uucp jobs for the cron daemon, including the uudemon.cleanu shell procedure. Contains files removed by the uucleanup command. RELATED INFORMATION
Commands: cron(8), uucp(1), uustat(1), uux(1) delim off uucleanup(8)
All times are GMT -4. The time now is 08:09 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy