Sponsored Content
Full Discussion: event or file wait scenario
Top Forums Shell Programming and Scripting event or file wait scenario Post 302285740 by rajesh_tns on Monday 9th of February 2009 02:57:11 PM
Old 02-09-2009
event or file wait scenario

i want to do 2 things

1) i should wait for a file called A.txt to fall on a specific path on the server
2) once the file arrives immediately another script called B.sh should be executed.

Could you please throw somelight on this.
Any code if already present that would be helpful.

Regards
Rajesh
 

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Lock a file. AND Wait if file is locked

Hi, I want to do the foll steps: 1. Check if someone has a lock on my file1. 2. if file1 is locked by any other user wait in a loop till another user releases lock 3. when lock released, lock file1. 4. do procesing (write) on file1. 5. processing complete. release lock on file1. ... (2 Replies)
Discussion started by: sunil_neha
2 Replies

2. UNIX for Dummies Questions & Answers

How to find the File Age and wait for that...

Hi, I want to know my file is 1 hr 30 min old or not, If 1 hr 30 min old I will do some tasks in that file.. other wise I will wait to 1 hr 30 min and then do the tasks.. how to do it in Unix script? any idea? (3 Replies)
Discussion started by: redlotus72
3 Replies

3. Shell Programming and Scripting

Need to execute 2 scripts, wait, execute 2 more wait, till end of file

:cool: I need to execute a shell script to do the following: cat a file run two back ground processes using the first two values from the file wait till those background processes finish run two more background processes using the next two values from the file wait till those background... (1 Reply)
Discussion started by: halo98
1 Replies

4. Shell Programming and Scripting

wait command - cat it wait for not-chile process?

Did not use 'wait' yet. How I understand by now the wait works only for child processes, started background. Is there any other way to watch completion of any, not related process (at least, a process, owned by the same user?) I need to start a background process, witch will be waiting... (2 Replies)
Discussion started by: alex_5161
2 Replies

5. Shell Programming and Scripting

file sending scenario

hi all i have a view in the database with columns prod_no,prod_nm, prod_code using a shell script i should query this view and dump the data in a delimited flat file and send to another ftp server.... i also have to schedule this periodically using cron tab. can you... (2 Replies)
Discussion started by: rajesh_tns
2 Replies

6. Shell Programming and Scripting

Script to wait until file is updated

Hello, I need to evaluate (under BASH) if the certain file has been updated or not. If the file still wasn't updated, script should wait. The script picks up the time stamp of the file using command OldTimestamp=$(date -r $MyDir/$MyFile), but I don't know how to code a waiting loop with new and... (6 Replies)
Discussion started by: sameucho
6 Replies

7. Shell Programming and Scripting

calling a shell script in background and wait using "wait" in while loop

Hi, I am facing a strange issue, when i call a script from my while loop in background it doesnt go in background, despite the wait i put below the whil loop it goes forward even before the process put in background is completed. cat abc.txt | while read -u4 line do #if line contains #... (2 Replies)
Discussion started by: mihirvora16
2 Replies

8. Shell Programming and Scripting

Look for a file,if not found wait and look again

Hi All, i have a requirement I created a file list as below : more abc_file_list.txt Rem_DD.csv Rem_Non.csv Rem_Ld.csv CC_Ld_Non_IRA.csv ... Above are the 4 files (For now ,we dont know how many in the file) which need to be present else need to get an email for missing files. ... (3 Replies)
Discussion started by: dssyadav
3 Replies
smtpd(n)						      Tcl SMTP Server Package							  smtpd(n)

__________________________________________________________________________________________________________________________________________________

NAME
smtpd - Tcl SMTP server implementation SYNOPSIS
package require Tcl 8.3 package require smtpd ?1.4? ::smtpd::start ?myaddr? ?port? ::smtpd::stop ::smptd::configure ?option value? ?option value ...? ::smtpd::cget ?option? _________________________________________________________________ DESCRIPTION
The smtpd package provides a simple Tcl-only server library for the Simple Mail Transfer Protocol as described in RFC 821 (http://www.rfc- editor.org/rfc/rfc821.txt) and RFC 2821 (http://www.rfc-editor.org/rfc/rfc2821.txt). By default the server will bind to the default net- work address and the standard SMTP port (25). This package was designed to permit testing of Mail User Agent code from a developers workstation. It does not attempt to deliver mail to your mailbox. Instead users of this package are expected to write a procedure that will be called when mail arrives. Once this procedure returns, the server has nothing further to do with the mail. SECURITY
On Unix platforms binding to the SMTP port requires root privileges. I would not recommend running any script-based server as root unless there is some method for dropping root privileges immediately after the socket is bound. Under Windows platforms, it is not necessary to have root or administrator privileges to bind low numbered sockets. However, security on these platforms is weak anyway. In short, this code should probably not be used as a permanently running Mail Transfer Agent on an Internet connected server, even though we are careful not to evaluate remote user input. There are many other well tested and security audited programs that can be used as mail servers for internet connected hosts. COMMANDS
::smtpd::start ?myaddr? ?port? Start the service listening on port or the default port 25. If myaddr is given as a domain-style name or numerical dotted-quad IP address then the server socket will be bound to that network interface. By default the server is bound to all network interfaces. For example: set sock [::smtpd::start [info hostname] 0] will bind to the hosts internet interface on the first available port. At present the package only supports a single instance of a SMTP server. This could be changed if required at the cost of making the package a little more complicated to read. If there is a good reason for running multiple SMTP services then it will only be neces- sary to fix the options array and the ::smtpd::stopped variable usage. As the server code uses fileevent(n) handlers to process the input on sockets you will need to run the event loop. This means either you should be running from within wish(1) or you should vwait(n) on the ::smtpd::stopped variable which is set when the server is stopped. ::smtpd::stop Halt the server and release the listening socket. If the server has not been started then this command does nothing. The ::smtpd::stopped variable is set for use with vwait(n). It should be noted that stopping the server does not disconnect any currently active sessions as these are operating over an inde- pendent channel. Only explicitly tracking and closing these sessions, or exiting the server process will close down all the running sessions. This is similar to the usual unix daemon practice where the server performs a fork(2) and the client session continues on the child process. ::smptd::configure ?option value? ?option value ...? Set configuration options for the SMTP server. Most values are the name of a callback procedure to be called at various points in the SMTP protocol. See the CALLBACKS section for details of the procedures. -validate_host proc Callback to authenticate new connections based on the ip-address of the client. -validate_sender proc Callback to authenticate new connections based on the senders email address. -validate_recipient proc Callback to validate and authorize a recipient email address -deliverMIME proc Callback used to deliver mail as a mime token created by the tcllib mime package. -deliver proc Callback used to deliver email. This option has no effect if the -deliverMIME option has been set. ::smtpd::cget ?option? If no option is specified the command will return a list of all options and their current values. If an option is specified it will return the value of that option. CALLBACKS
validate_host callback This procedure is called with the clients ip address as soon as a connection request has been accepted and before any protocol com- mands are processed. If you wish to deny access to a specific host then an error should be returned by this callback. For example: proc validate_host {ipnum} { if {[string match "192.168.1.*" $ipnum]} { error "go away!" } } If access is denied the client will receive a standard message that includes the text of your error, such as: 550 Access denied: I hate you. As per the SMTP protocol, the connection is not closed but we wait for the client to send a QUIT command. Any other commands cause a 503 Bad Sequence error. validate_sender callback The validate_sender callback is called with the senders mail address during processing of a MAIL command to allow you to accept or reject mail based upon the declared sender. To reject mail you should throw an error. For example, to reject mail from user "denied": proc validate_sender {address} { eval array set addr [mime::parseaddress $address] if {[string match "denied" $addr(local)]} { error "mailbox $addr(local) denied" } return } The content of any error message will not be passed back to the client. validate_recipient callback The validate_recipient callback is similar to the validate_sender callback and permits you to verify a local mailbox and accept mail for a local user address during RCPT command handling. To reject mail, throw an error as above. The error message is ignored. deliverMIME callback ] The deliverMIME callback is called once a mail message has been successfully passed to the server. A mime token is constructed from the sender, recipients and data and the users procedure it called with this single argument. When the call returns, the mime token is cleaned up so if the user wishes to preserve the data she must make a copy. proc deliverMIME {token} { set sender [lindex [mime::getheader $token From] 0] set recipients [lindex [mime::getheader $token To] 0] set mail "From $sender [clock format [clock seconds]]" append mail " " [mime::buildmessage $token] puts $mail } deliver callback The deliver callback is called once a mail message has been successfully passed to the server and there is no -deliverMIME option set. The procedure is called with the sender, a list of recipients and the text of the mail as a list of lines. For example: proc deliver {sender recipients data} { set mail "From $sender [clock format [clock seconds]]" append mail " " [join $data " "] puts "$mail" } Note that the DATA command will return an error if no sender or recipient has yet been defined. VARIABLES
::smtpd::stopped This variable is set to true during the ::smtpd::stop command to permit the use of the vwait(n) command. AUTHOR
Written by Pat Thoyts mailto:patthoyts@users.sourceforge.net. LICENSE
This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MER- CHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the file "license.terms" for more details. BUGS, IDEAS, FEEDBACK This document, and the package it describes, will undoubtedly contain bugs and other problems. Please report such in the category smtpd of the Tcllib SF Trackers [http://sourceforge.net/tracker/?group_id=12883]. Please also report any ideas for enhancements you may have for either package and/or documentation. KEYWORDS
rfc 2821, rfc 821, services, smtp, smtpd, socket, vwait COPYRIGHT
Copyright (c) Pat Thoyts <patthoyts@users.sourceforge.net> smtpd 1.4 smtpd(n)
All times are GMT -4. The time now is 06:38 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy