On Tue, 04 Apr 2000 01:31:03 -0500, Bryn Joynes wrote:
>I'm running Distributed.net's number cruncher and place it into the
>background with the & at the end of the command and all has worked
>well. The problem is when I leave the keyboard I want to log off for
>security and come back sometime later and bring the process to the
>foreground again.
I find it preferable to have dnetc display only to the logs(I use the
-quiet parameter, which also detaches dnetc without having to use &),
and create some simple tools to make glancing at the logs easy. I also
start dnetc at boot-up from rc.local, so it's always running in the
background.
When doing this, it's best to specify full paths to your client
directory and files. e.g.(from my dnetc.ini file):
----------------------
[buffers]
buffer-file-basename=/home/oloryn/bovine/buff-in
output-file-basename=/home/oloryn/bovine/buff-out
checkpoint-filename=/home/oloryn/bovine/ckpoint.rc5
[logging]
log-file-type=rotate
log-file-limit=weekly
log-file=/home/oloryn/bovine/rc5des
----------------------
Obviously, in my case dnetc sits in /home/oloryn/bovine. You'll note I
have the logs rotate weekly. I also have a perl script called
lastrc5log which prints the name of the last rc5 log to stdout:
----------------------
#!/usr/bin/perl -w
use strict;
my $CLIENTDIR = '/home/oloryn/bovine';
opendir(CLIENTDIR, $CLIENTDIR) || die "Can't open $CLIENTDIR - $!";
my @logs = sort(grep(/^rc5des.*\.log$/, readdir(CLIENTDIR)));
closedir(CLIENTDIR) || die "Can't close $CLIENTDIR - $!";
my $lastlog = pop(@logs);
print "$CLIENTDIR/$lastlog";
----------------------
This makes it easy to create short scripts to check the most recent
dnetc log. E.g., I have this script:
----------------------
#!/bin/bash
tail -n 22 $(lastrc5log)
----------------------
which shows the last page of output from dnetc. A slight variation:
----------------------
#!/bin/bash
tail -f -n 22 $(lastrc5log)
----------------------
shows the last page of output and waits for(and displays) any further
output to the log. Just kill it(hit Ctrl-C) when you want out. This
effectively gives you the same functionality you were looking for,
without having to foreground dnetc.
If I want to wade through the log, there's
----------------------
#!/bin/bash
less +G $(lastrc5log)
----------------------
which runs less at the end of the most recent log file(from which I
typically scroll back). If you're going to use these often, it's handy
to give them 1 or 2 letter names(in my case t, tf, and l,
respectively).
Ben
--
Ben Coleman ">oloryn@mindspring.com | The attempt to legislatively
http://oloryn.home.mindspring.com/ | micromanage equality results, at
| best, in equal misery for all.
--
To unsubscribe: mail ">majordomo@ale.org with "unsubscribe ale" in message body.