Sponsored Content
Top Forums Shell Programming and Scripting Need help for automated pickup of file based on a priority Post 302864103 by vikramgk9 on Wednesday 16th of October 2013 01:57:35 AM
Old 10-16-2013
Need help for automated pickup of file based on a priority

Hi experts,

I am facing a problem right now.I have to automate the pickup of files based on a priority.The scenario is as below:

1) There will be files from Mon-Fri with Mon file being named as abc_def_01_YYYYMMDD and Tue file being abc_def_02_YYYYMMDD and so forth till Friday's file which would be abc_def_YYYYMMDD.

2) I have to set a priority such that if on any given day if i have more than one file, I have to send the earlier file first.For instance if on Thursday i have monday's file and wednesday's file I have to send the Monday's file first, then after a pre-defined delay send Wednesday's file-delay- and then send the thursday's file.

3) The trigger for the script is the file itself.Incoming file will trigger the script.

To start with, I have written the following code which stores the filenames in separate variables:

Code:
#!/sh/bin

cd /location

for i in `ls -lrt /location | awk '{print $9}'`
do

if [ "`echo $i | awk '{print $1}' | cut -d'_' -f3`" = "01" ]; then
   first_file="$i"
elif [ "`echo $i | awk '{print $1}' | cut -d'_' -f3`" = "02" ]; then
   second_file="$i"
elif [ "`echo $i | awk '{print $1}' | cut -d'_' -f3`" = "03" ]; then
   third_file="$i"
elif [ "`echo $i | awk '{print $1}' | cut -d'_' -f3`" = "04" ]; then
   fourth_file="$i"
elif [ "`echo $i | awk '{print $1}' | cut -d'_' -f3`" = "05" ]; then
   fifth_file="$i"
else
echo "i am in the else loop" >> /dev/null
fi

done

Having done this i dont know how to set the priority so that at any given day if there is more than one file, the file of the earlier day of the week should be sent first.

Kindly help me on this.Thanks in advance Smilie

Last edited by vbe; 10-16-2013 at 09:33 AM.. Reason: badly placed icodes... replaced by code tags...
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

pickup file from folder

Hi, Can any body help me,How to pickup file from folder using shellscript. FolderName:/test FileinFolder: test.txt MY req is:Shellscript pickup file from folder and pass file as parameter to java program..? Thanks, Rams (0 Replies)
Discussion started by: ram2s2001
0 Replies

2. UNIX for Dummies Questions & Answers

pickup files.

How can I pickup files with a specific date by "ls" command without options? (1 Reply)
Discussion started by: gd2003
1 Replies

3. Emergency UNIX and Linux Support

Low priority file????

Hi all, which file has the low priority while linux booting?. I just want to run a script in background with low priority while linux boots up.(I need to include that script to be called from that file) as am a newbie to linux. Any help is appreciated. Thanks, SMNK (2 Replies)
Discussion started by: SMNK
2 Replies

4. Shell Programming and Scripting

NOT able to pickup files

Hi, I have two files to pick and excute these ones. File1:DOLFIN.PRL_100.OIB.TLU.001.D20110510.T144948 File2:DOLFIN.PRM_100.OTU.001.D20100726.T050026 date '+%H:%M:%S' SCRIPTS_PATH=/u/dolfin/bin . ${SCRIPTS_PATH}/set_dolfin_env.sh DATA_FILE_NAME=DATA_FILE DATE_FORMAT=`date... (2 Replies)
Discussion started by: shyamu544
2 Replies

5. Linux

Determining Values for NIce and Priority items in limits.conf file

I've been looking online trying to find the correct value nice and priority can take in the limits.conf file. ON the man page it says; Does this mean priority can be any negative number and any positive? Then Does this mean any number between -20 and 19 also what does the definition of nice... (13 Replies)
Discussion started by: matthewfs
13 Replies

6. Shell Programming and Scripting

Need an automated pre-defined file pickup method

Hi Gurus, I need to develop a script which picks the files in a pre-defined order. The files from monday-friday will be named as abc_01_20130923 as monday's file and abc_02_20130924 as tuesday's..so..so forth till friday's which will be named as abc_05_20130927.It repeats over for the... (3 Replies)
Discussion started by: vikramgk9
3 Replies

7. Shell Programming and Scripting

How to copy files from one location to another based on a priority?

Hi Gurus, I am a newbie to shell scripting and I am facing a problem right now.I have to automate the copy of files based on a priority.The scenario is as below: 1) There will be files from Mon-Fri with Mon file being named as abc_def_01_YYYYMMDD and Tue file being abc_def_02_YYYYMMDD and so... (4 Replies)
Discussion started by: vikramgk9
4 Replies

8. Shell Programming and Scripting

Consolidate files based on priority

please help, I would like to merge 4 files, all of them same format. The first col is the key for all files,followed by variable number of fields so I want to check if the key is present in the files according to priority and then also add a column saying it came from which file . So the... (4 Replies)
Discussion started by: ritakadm
4 Replies

9. UNIX for Beginners Questions & Answers

Providing virtual machine priority in kvm based virtual machines

Hi All, Is there any way I can prioritize my VMs when there is resource crunch in host machine so that some VMs will be allocated more vcpu, more memory than other VMs in kvm/qemu hypervisor based virtual machines? Lets say in my cloud environment my Ubuntu 16 compute hosts are running some... (0 Replies)
Discussion started by: SanjayK
0 Replies
PICKUP(8)						      System Manager's Manual							 PICKUP(8)

NAME
pickup - Postfix local mail pickup SYNOPSIS
pickup [generic Postfix daemon options] DESCRIPTION
The pickup(8) daemon waits for hints that new mail has been dropped into the maildrop directory, and feeds it into the cleanup(8) daemon. Ill-formatted files are deleted without notifying the originator. This program expects to be run from the master(8) process manager. STANDARDS
None. The pickup(8) daemon does not interact with the outside world. SECURITY
The pickup(8) daemon is moderately security sensitive. It runs with fixed low privilege and can run in a chrooted environment. However, the program reads files from potentially hostile users. The pickup(8) daemon opens no files for writing, is careful about what files it opens for reading, and does not actually touch any data that is sent to its public service endpoint. DIAGNOSTICS
Problems and transactions are logged to syslogd(8). BUGS
The pickup(8) daemon copies mail from file to the cleanup(8) daemon. It could avoid message copying overhead by sending a file descriptor instead of file data, but then the already complex cleanup(8) daemon would have to deal with unfiltered user data. CONFIGURATION PARAMETERS
As the pickup(8) daemon is a relatively long-running process, up to an hour may pass before a main.cf change takes effect. Use the command "postfix reload" command to speed up a change. The text below provides only a parameter summary. See postconf(5) for more details including examples. CONTENT INSPECTION CONTROLS
content_filter (empty) After the message is queued, send the entire message to the specified transport:destination. receive_override_options (empty) Enable or disable recipient validation, built-in content filtering, or address mapping. MISCELLANEOUS CONTROLS
config_directory (see 'postconf -d' output) The default location of the Postfix main.cf and master.cf configuration files. ipc_timeout (3600s) The time limit for sending or receiving information over an internal communication channel. line_length_limit (2048) Upon input, long lines are chopped up into pieces of at most this length; upon delivery, long lines are reconstructed. max_idle (100s) The maximum amount of time that an idle Postfix daemon process waits for an incoming connection before terminating voluntarily. max_use (100) The maximal number of incoming connections that a Postfix daemon process will service before terminating voluntarily. process_id (read-only) The process ID of a Postfix command or daemon process. process_name (read-only) The process name of a Postfix command or daemon process. queue_directory (see 'postconf -d' output) The location of the Postfix top-level queue directory. syslog_facility (mail) The syslog facility of Postfix logging. syslog_name (see 'postconf -d' output) The mail system name that is prepended to the process name in syslog records, so that "smtpd" becomes, for example, "postfix/smtpd". SEE ALSO
cleanup(8), message canonicalization sendmail(1), Sendmail-compatible interface postdrop(1), mail posting agent postconf(5), configuration parameters master(5), generic daemon options master(8), process manager syslogd(8), system logging LICENSE
The Secure Mailer license must be distributed with this software. AUTHOR(S) Wietse Venema IBM T.J. Watson Research P.O. Box 704 Yorktown Heights, NY 10598, USA PICKUP(8)
All times are GMT -4. The time now is 02:17 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy