I can't get my head around a problem I have with a control file.
The file is to control a "Listener" of sorts that listens on a named pipe. A script kicks off the listener in the background and passes it a control file. In the file it sets the Status field to pending. It then waits for the listener to get up and running and change its status to "Listening" before launching another job that uses the named pipe to report its status.
The control file: -
The listener uses a function (that works 90% of the time) to change the status to Listening -
C_MSG_JOB_STATUS is the line number for the status field
MSG_CTL_FILE is the control file
and "Listening" is my change of status
When I look in the tmp file this function uses after I time out waiting for the listener to change its status to listening -
So the function has written it to the tmp file. The check on the exit status for the cp command doesn't seem to error or I would see an error log in /tmp. So I can't understand why the tmp file and the control file aren't the same....
like I said, most of the time this code works.
I'm wondering if this is some sort of buffering problem and whether I need to adopt a safer method that explicitly closes the file or something???
Have you checked the timestamps on ${MSG_CTL_FILE} and ${U_MSG_TMPFILE}?
Are you sure that the cp in m_write_ctl_file_field() didn't succeed and then something else updated ${MSG_CTL_FILE} changing the status back to Pending?
I'm sure nothing else is writing it back again as each file has a unique name with a RND number appended. On top of that I don't have any code writing Pending to it at the moment.
I have just run this in a loop and then run an lsof and can see I have hundreds of open files in use by listeners that should be closed-
The listener is u_listener and I have hundreds of files in use which probably explains why the problem is getting worse throughout the day...
ps shows that I have lots of open instances of the process -
I have just introduced some functionality to exit in the event of fatal errors and this problem started when I was running some test jobs that failed.
I hope this means that I just need to extend the clean exit to explicitely kill off listeners that haven't exited prior to exiting the main application.
I assume that you've verified that your RND number generator hasn't generated the same number for two or more temp files. Random is not the same as different; and for an application like this, different is what you need.
I facing a problem :
I have a Source and Destination directory. The Source directory is linked to SVN and is updated by the Script to Head Revision.
After that i copy the Source to Destination by this command:
cp -r /SOURCE PATH /DESTIUNATION PATH
Now if a delete a file in source and... (5 Replies)
Hi experts
cp bin root src /mnt
but not copy bin/bigfile
any help?
( I post this thread in the "redhat" forum wrongly, I don't know how to withdraw that question in that wrong forum)
Thanks (6 Replies)
I want to copy tar file to another machine. tar size is 4gb.
Firstly I tried copy to windows machine with ftp client but copy operation didn't start.
Now I have tryied to copy to solaris machine command with scp but copy was freezed. Picture is attached.... (1 Reply)
Around a month ago we suffered a prolonged power outage, due to circumstances the servers and storage arrays were still in use when the UPS dropped. One of the servers was running a flash copy on the database while batch processing had commenced. This is the only server that suffered any further... (2 Replies)
I'm having a problem copy/pasting from a txt file in windows to vi. What happens is I copy a chunk of text, go to the putty terminal, go into insert mode, and right click, and it will stop pasting at a random point and freeze up. Nothing I do gets out of it.
This only happens on my account... (1 Reply)
Hello,
I made a script to copy files from one directory to another and move file after the copy is done. When files are present in the source directory there is no problem but when no file are present I'm getting an error.
Please help !!
---------------------
#!/bin/bash
... (2 Replies)
Hi,
Say I have this text file <copy.out> that contains a list of files/directories to be copied out to a different location.
$ more copy.out
dir1/file1
dir1/file2
dir1/file3
"dir1/white space"
dir1/file4
If I do the following:
$copy=`more copy.out`
$echo $copy
dir1/file1... (4 Replies)
Hi there....I'm new for the UNIX...
just wondering if there is any method that can telnet to a server without typing the userID and PWD each time...
that is any command or scripts that allows me to enter the server directly?
also...after i enter the server...
i want to get some files then... (17 Replies)