Sponsored Content
Top Forums Shell Programming and Scripting How to send a file in UNIX through email which is created only 15 minutes before the current time? Post 302989403 by puneetkhullar on Thursday 12th of January 2017 04:46:58 AM
Old 01-12-2017
Linux How to send a file in UNIX through email which is created only 15 minutes before the current time?

I wanted to send an email to the client whenever there is failed record created in a /feed/HR-76/failed folder after processing of feed file.

I can find out with the help of below script that what is the new file created but that file didn't make just 15 minutes before.

Code:
LogDir=/feed/HR-76/failed
EMAIL1=xxx@gmail.com
SUBJECT=Failed
MESSAGE="Failed records"
SMTP="SMTPHOSTNAME"
SENDER=no-reply@gmail.com

inode=$(find /feed/HR-76/failed -maxdepth 1 -type f -iname '*.txt' -printf '%T@ %i\n' | sort -rn | awk '{print $2;exit;}')
newest=$(find /feed/HR-76/failed -maxdepth 1 -inum "$inode")
echo -e "$MESSAGE" | mailx -S smtp="$SMTP" -a "$OUT" -r "$newest" -s "$SUBJECT" "$EMAIL1"

Above code is giving me only file is on the top.

There is some time when there will be no failed record but this code is sending already existing file.

I want to send only failed record file which is created only 15 minutes before otherwise no file should send.The format of file is Employee_DD-MM-YYYY_HH-MM-SS.txt
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How can I create a file with current time - 60 minutes

I'm using k-shell in unix and I want to create a file with the current system time - 60 minutes. I know I can use touch to create the file, but I'm having trouble specifying how tell it to use the current time less 60 minutes. Any ideas??? (4 Replies)
Discussion started by: DaveyTN
4 Replies

2. UNIX for Advanced & Expert Users

Adding # minutes to current time...

Hi all, Looking for a way to add lets say 10 minutes to the current time output should look like 7:15 AM or 7:15 PM. I know that gdate could do this for me but unfortunately its not available on the system I'm working on. So if any one know any way I can accomplish this using the date command it... (7 Replies)
Discussion started by: gptavares
7 Replies

3. Shell Programming and Scripting

How can i search a file which has been created or modified in last five minutes

Hi Can some one please help me How can i search a file which has been created or modified in last five minutes I have used the command find . -mmin -5 and it does not work i get an error -mmin is bad option Please help Much regards Tarun (2 Replies)
Discussion started by: tarundeepdhawan
2 Replies

4. Shell Programming and Scripting

How to send email once a day at certain time in unix shell script

hi, i have to send an email once a day at ceratin time say 22. i have tried with date commad, but not working.:( HOUROFTHEDAY=`date +'%H'` if ; then mailx -s "Info" emailid@org.com < $ProcessStatisticsFile fi Please help me... (5 Replies)
Discussion started by: sreelu
5 Replies

5. UNIX for Dummies Questions & Answers

Adding hours and minutes to current date (Only to date not to time)

Hi, I want to add some hours and minutes to the current date. For example, if the current date is "July 16, 2012 15:20", i want to add 5 hours 30 minutes to "July 16, 2012 00:00" not to "July 16, 2012 15:20". Please help. Thanks! (4 Replies)
Discussion started by: manojgarg
4 Replies

6. Shell Programming and Scripting

Check how many minutes ago the last file created

Hi , I need help in getting how many minutes ago the last file, matching some pattern in file name, was created in a folder. Thanks in advance. (8 Replies)
Discussion started by: Anupam_Halder
8 Replies

7. Shell Programming and Scripting

How to extract logs between the current time and the last 15 minutes ?

I want to extract the logs between the current time stamp and 15 minutes before and sent an email to the people configured. I developed the below script but it's not working properly; can someone help me?? I have a log file containing this pattern: Constructor QuartzJob ... (3 Replies)
Discussion started by: puneetkhullar
3 Replies

8. Shell Programming and Scripting

Check file creation Time minutes and if file older then 5 minutes execute some stuff

Hello all, Info: System RedHat 7.5 I need to create a script that based on the creation time, if the file is older then 5 minutes then execute some stuff, if not exit. I thought to get the creation time and minutes like this. CreationTime=$(stat -c %y /tmp/test.log | awk -F" " '{ print... (3 Replies)
Discussion started by: charli1
3 Replies

9. UNIX for Beginners Questions & Answers

Find if create time of last created file in a directory is older than 5 minutes

A process xyz is running and creating file1, file2, file3, .... filen. how do i know if the process has stopped and createtime of the last file (filen) is older than 5 minutes? OS is AIX (3 Replies)
Discussion started by: malaika
3 Replies

10. UNIX for Beginners Questions & Answers

rsync a file as it gets created and after 3 minutes old

- run a backup job - The jobs creates partial files one after the other, about 2 minutes interval. What i want to do is that while the job is still running or while a file was last modified or created 3 minutes ago, the file should be rsync to a remote server untill the last file has been... (4 Replies)
Discussion started by: malaika
4 Replies
mapiproxy/libmapistore/mapistore_errors.h(3)		   OpenChange mapistore library 	      mapiproxy/libmapistore/mapistore_errors.h(3)

NAME
mapiproxy/libmapistore/mapistore_errors.h - This header provides a set of result codes for MAPISTORE function calls. SYNOPSIS
Enumerations enum mapistore_error { MAPISTORE_SUCCESS = 0, MAPISTORE_ERROR = 1, MAPISTORE_ERR_NO_MEMORY = 2, MAPISTORE_ERR_ALREADY_INITIALIZED = 3, MAPISTORE_ERR_NOT_INITIALIZED = 4, MAPISTORE_ERR_CORRUPTED = 5, MAPISTORE_ERR_INVALID_PARAMETER = 6, MAPISTORE_ERR_NO_DIRECTORY = 7, MAPISTORE_ERR_DATABASE_INIT = 8, MAPISTORE_ERR_DATABASE_OPS = 9, MAPISTORE_ERR_BACKEND_REGISTER = 10, MAPISTORE_ERR_BACKEND_INIT = 11, MAPISTORE_ERR_CONTEXT_FAILED = 12, MAPISTORE_ERR_INVALID_NAMESPACE = 13, MAPISTORE_ERR_NOT_FOUND = 14, MAPISTORE_ERR_REF_COUNT = 15, MAPISTORE_ERR_EXIST = 16, MAPISTORE_ERR_INVALID_DATA = 17, MAPISTORE_ERR_MSG_SEND = 18, MAPISTORE_ERR_MSG_RCV = 19, MAPISTORE_ERR_DENIED = 20, MAPISTORE_ERR_NOT_IMPLEMENTED } Detailed Description This header provides a set of result codes for MAPISTORE function calls. Enumeration Type Documentation enum mapistore_error Enumerator: MAPISTORE_SUCCESS The function call succeeded. MAPISTORE_ERROR The function call failed for some non-specific reason. MAPISTORE_ERR_NO_MEMORY The function call failed because it was unable to allocate the memory required by underlying operations. MAPISTORE_ERR_ALREADY_INITIALIZED The function call failed because underlying context has already been initialized. MAPISTORE_ERR_NOT_INITIALIZED The function call failed because context has not been initialized. MAPISTORE_ERR_CORRUPTED The function call failed because an internal mapistore storage component has corrupted data. MAPISTORE_ERR_INVALID_PARAMETER The function call failed because one of the function parameters is invalid. MAPISTORE_ERR_NO_DIRECTORY The function call failed because the directory doesn't exist. MAPISTORE_ERR_DATABASE_INIT The function call failed because the underlying function couldn't open a database. MAPISTORE_ERR_DATABASE_OPS The function call failed because the underlying function didn't run a database operation successfully. MAPISTORE_ERR_BACKEND_REGISTER The function failed to register a storage backend. MAPISTORE_ERR_BACKEND_INIT One of more storage backend initialization functions failed to complete successfully. MAPISTORE_ERR_CONTEXT_FAILED The function failed because mapistore failed to create a context. MAPISTORE_ERR_INVALID_NAMESPACE The function failed because the provided namespace is invalid. MAPISTORE_ERR_NOT_FOUND The function failed to find requested record/data. MAPISTORE_ERR_REF_COUNT The function still has a reference count. MAPISTORE_ERR_EXIST The function already have record/data for the searched element. MAPISTORE_ERR_INVALID_DATA The function failed to generate requested data/payload. MAPISTORE_ERR_MSG_SEND The function failed to send message. MAPISTORE_ERR_MSG_RCV The function failed to receive message. MAPISTORE_ERR_DENIED The operation required privileges that the user does not have. MAPISTORE_ERR_NOT_IMPLEMENTED The function is not implemented. Author Generated automatically by Doxygen for OpenChange mapistore library from the source code. Version 1.0 Sat Jun 14 2014 mapiproxy/libmapistore/mapistore_errors.h(3)
All times are GMT -4. The time now is 03:24 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy