Something like the following seems to work:
------------------------------------------------------------------------------
$ cat krenew-tmux-wrapper
#!/bin/bash

if [ $(tmux ls 2>/dev/null | wc -l) -gt 0 ]; then
        exit 1
fi

tmux kill-server >/dev/null 2>&1
tmux new -d

while [ $(tmux ls 2>/dev/null | wc -l) -gt 0 ]; do
        sleep 60
done
------------------------------------------------------------------------------

Then I can do "krenew -biL -- krenew-tmux-wrapper" and it works
similar to the screen version.

I still think it would be a nice feature if "tmux start" could be made
not to fork.

BTW, I could not get "tmux start" to do anything at all. What's it
supposed to do?
$ tmux ls
server not found: No such file or directory
$ tmux start
$ tmux ls
server not found: No such file or directory

Best,
 Mika

On Mon, Aug 30, 2010 at 18:36, Mika Fischer <mika.fisc...@zoopnet.de> wrote:
> Yes, but this cloning the credentials cache and changing the
> environment works only when giving a command to execute. When I give
> "tmux new -d" as the command, krenew will immediately exit and remove
> the cloned credentials cache, because tmux forks and exits. So this is
> not a real solution.
>
> I guess I could come up with a script that calls tmux new -d and then
> check whether the session still exists and if not, exit.
>
> Using this script as the command for krenew should work. It's a little
> bit ugly though. I'll give it a try tomorrow and report back, whether
> it's a viable workaround.
>
> Best,
>  Mika
>
> On Mon, Aug 30, 2010 at 18:30, Nicholas Marriott
> <nicholas.marri...@gmail.com> wrote:
>> If it changes the environment before forking, tmux should pick it up as
>> well.
>>
>> You'll need to do something different to monitor for tmux exiting and
>> make krenew exit.
>>
>>
>> On Mon, Aug 30, 2010 at 06:24:48PM +0200, Mika Fischer wrote:
>>> Yes, I'm sure. It is possible because krenew is the parent of the
>>> "screen -Dm", so it can change its environment before forking.
>>>
>>> $ echo $KRB5CCNAME
>>> FILE:/tmp/krb5cc_11543_McyAWZ
>>> $ krenew -- bash
>>> $ echo $KRB5CCNAME
>>> /tmp/krb5cc_11543_j2DI5W
>>>
>>> Best,
>>>  Mika
>>>
>>> On Mon, Aug 30, 2010 at 18:19, Nicholas Marriott
>>> <nicholas.marri...@gmail.com> wrote:
>>> > On Mon, Aug 30, 2010 at 04:56:36PM +0200, Mika Fischer wrote:
>>> >> Hi Nicholas,
>>> >>
>>> >> A few reasons:
>>> >> - Cloning the credentials cache is important when you use ssh, because
>>> >> ssh will delete the original credentials cache on logout. Cloning the
>>> >> credentials cache is only possible when krenew is given a command to
>>> >> execute.
>>> >> - Because of the cloning krenew needs to change the environment
>>> >> variable pointing the the credentials cache.
>>> >
>>> > are you sure it changes the environment variable? that is not normally
>>> > possible, it doesn't just renew what is already in there?
>>> >
>>> >> - When running krenew with screen -Dm, the cloned tickets are removed
>>> >> when they're no longer needed. If you run krenew separately, you will
>>> >> have to kill it manually.
>>> >>
>>> >> Best,
>>> >> ??Mika
>>> >>
>>> >> On Mon, Aug 30, 2010 at 16:38, Nicholas Marriott
>>> >> <nicholas.marri...@gmail.com> wrote:
>>> >> > hi
>>> >> >
>>> >> > why not just run krenew separately from tmux?
>>> >> >
>>> >> >
>>> >> > On Mon, Aug 30, 2010 at 03:59:20PM +0200, Mika Fischer wrote:
>>> >> >> Hi,
>>> >> >>
>>> >> >> in environments with Kerberos and especially NFS with Kerberos, it is
>>> >> >> important to keep the Kerberos credentials valid by renewing them at
>>> >> >> the proper time. Doubly so with screen or tmux sessions since they
>>> >> >> typically run for a longer time.
>>> >> >>
>>> >> >> There is the tool krenew which does this automatically. What it does
>>> >> >> is it clones the credentials cache, updates the appropriate
>>> >> >> environment variable, then starts the program and *while the program
>>> >> >> is running*, renews the credentials at the proper time. If the program
>>> >> >> exits, krenew exits as well, deleting the cloned credentials cache.
>>> >> >>
>>> >> >> It is possible to use screen together with krenew, by starting a
>>> >> >> screen session like this:
>>> >> >> krenew -b -- screen -D -m
>>> >> >>
>>> >> >> This starts a detached screen session but does not fork, so that
>>> >> >> krenew works properly.
>>> >> >>
>>> >> >> I haven't found a way to achieve this behavior with tmux. Is it
>>> >> >> currently possible? If so, how? If not, do you think it would be
>>> >> >> worthwhile to add an option to make it possible? Or do you have any
>>> >> >> other suggestions how to deal with this issue?
>>> >> >>
>>> >> >> Thanks in advance!
>>> >> >>
>>> >> >> Best,
>>> >> >> ??Mika
>>> >> >>
>>> >> >> ------------------------------------------------------------------------------
>>> >> >> Sell apps to millions through the Intel(R) Atom(Tm) Developer Program
>>> >> >> Be part of this innovative community and reach millions of netbook 
>>> >> >> users
>>> >> >> worldwide. Take advantage of special opportunities to increase 
>>> >> >> revenue and
>>> >> >> speed time-to-market. Join now, and jumpstart your future.
>>> >> >> http://p.sf.net/sfu/intel-atom-d2d
>>> >> >> _______________________________________________
>>> >> >> tmux-users mailing list
>>> >> >> tmux-users@lists.sourceforge.net
>>> >> >> https://lists.sourceforge.net/lists/listinfo/tmux-users
>>> >> >
>>> >> >
>>> >
>>> >
>>
>>
>

------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users

Reply via email to