Search Results

Search found 4 results on 1 pages for 'bobtheowl2'.

Page 1/1 | 1 

  • Duplicate pseudo terminals in linux

    - by bobtheowl2
    On a redhat box [ Red Hat Enterprise Linux AS release 4 (Nahant Update 3) ] Frequently we notice two people being assigned to the same pseudo terminal. For example: $who am i user1 pts/4 Dec 29 08:38 (localhost:13.0) user2 pts/4 Dec 29 09:43 (199.xxx.xxx.xxx) $who -m user1 pts/4 Dec 29 08:38 (localhost:13.0) user2 pts/4 Dec 29 09:43 (199.xxx.xxx.xxx) $whoami user2 This causes problems in a script because "who am i" returns two rows. I know there are differences between the two commands, and obviously we can change the script to fix the problem. But it still bothers me that two users are being returned with the same terminal. We suspect it may be related to dead sessions. Can anyone explain why two (non-unique) pts number are being assigned and/or how that can be prevented in the future?

    Read the article

  • Java FileLock for Reading and Writing

    - by bobtheowl2
    I have a process that will be called rather frequently from cron to read a file that has certain move related commands in it. My process needs to read and write to this data file - and keep it locked to prevent other processes from touching it during this time. A completely separate process can be executed by a user to (potential) write/append to this same data file. I want these two processes to play nice and only access the file one at a time. The nio FileLock seemed to be what I needed (short of writing my own semaphore type files), but I'm having trouble locking it for reading. I can lock and write just fine, but when attempting to create lock when reading I get a NonWritableChannelException. Is it even possible to lock a file for reading? Seems like a RandomAccessFile is closer to what I need, but I don't see how to implement that. Here is the code that fails: FileInputStream fin = new FileInputStream(f); FileLock fl = fin.getChannel().tryLock(); if(fl != null) { System.out.println("Locked File"); BufferedReader in = new BufferedReader(new InputStreamReader(fin)); System.out.println(in.readLine()); ... The exception is thrown on the FileLock line. java.nio.channels.NonWritableChannelException at sun.nio.ch.FileChannelImpl.tryLock(Unknown Source) at java.nio.channels.FileChannel.tryLock(Unknown Source) at Mover.run(Mover.java:74) at java.lang.Thread.run(Unknown Source) Looking at the JavaDocs, it says Unchecked exception thrown when an attempt is made to write to a channel that was not originally opened for writing. But I don't necessarily need to write to it. When I try creating a FileOutpuStream, etc. for writing purposes it is happy until I try to open a FileInputStream on the same file.

    Read the article

  • Ant var and property scope

    - by bobtheowl2
    I have a main build script that calls various targets. One of these targets needs to store a value and another target needs to display it. Obviously this is not working so I think it may be related to scope. I've tried var, property, and declaring the property outside of target1. Since var seems to be mutable, it looks like I need to use it instead, but each time my output is empty. Main script <antcall target="target1"/> <antcall target="display"/> In target1: <var name="myVar" value="${anotherVar}"/> In display: <echo>${myVar}</echo>

    Read the article

  • Searching the head of CVS

    - by bobtheowl2
    I'm looking for a 'relatively' easy way to search through cvs to look for a particular string in the HEAD revisions. I realize the way CVS stores versions makes this difficult. But I'm trying to come up with some script to allow this search (performance is not expected here). Currently this command will output the contents of the head files cvs co -r HEAD -p stdout = file contents (to be grepped for the search string) stderr = the file name/header info (to be grepped for the line that signifies file name). Ideally, I want to grep the contents and display the header + a few lines before and after the searched item (the output of this likely directed to some file). I found a way to grep the stdout and stderr using different values. And the resulting stdout/stderr displayed is in the right order. But any attempt to redirect it to a file messes up the order? { { cvs co -r HEAD -p myModule 4>&- | grep 'myString' 2>&4 4>&- } 4>&2 2>&1 >&3 3>&- | grep 'Check' >&2 3>&- } 3>&1 Question 1. Is there an easier way to do this all together? Question 2. If not, how do I get the output of the code above to append to a file in the same order as displayed on the console?

    Read the article

1