Re: How can I make a program keep running even after I logout?

2004-12-15 Thread O. Hartmann
Mat Kovach schrieb:
On Wed, Dec 15, 2004 at 07:40:02PM +0100, Nico Meijer wrote:
 

Hi,
   

I want to cvsup or/and portupgrade and logout but the program keep
running?
 

Try screen: /usr/ports/misc/screen
To run it, simply type `screen`, do your work, type Ctrl-A d to detach
(you can go home now). Log in again, type `screen -r`. Be happy.
   

You can also use nohup 

man 1 nohup
But screen is an excellent choice also but might be over kill 
for this specific purpose.

I use something like:
$ nohup sudo cvsup -g -L 2 /etc/cvsupdate 
appending output to /home/kovachme/nohup.out
 

Another way is using daemon(8) which seems in many cases much more 
useful than nohup.
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: How can I make a program keep running even after I logout?

2004-12-15 Thread Nikolas Britton
Rae Kim wrote:
I connect to my computer from school computer.
I want to cvsup or/and portupgrade and logout but the program keep running?
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]
 

Hi Rae, I asked this very same question back in (Job Control) back in 
November, first thing to know is that the default for the csh shell is 
not to hangup background jobs when you exit the shell. here is all the 
meat from that tread:

###This is the way I thought up on my own Rae###
$ ssh localhost
Password: 
Last login: Mon Nov 22 06:13:59 2004 from localhost
Copyright (c) 1980, 1983, 1986, 1988, 1990, 1991, 1993, 1994
  The Regents of the University of California.  All rights reserved.
FreeBSD 5.3-RELEASE-p1 (SPECTRA) #0: Sat Nov 20 23:30:17 CST 2004
Welcome to FreeBSD!
$ su
Password: 
spectra# cvsup -g -L 2 /root/ports-supfile  /root/ports-supfile.log
[1] 71669
spectra# exit
exit
$ exit
Connection to localhost closed.
$ tail /root/ports-supfile.log
Add delta 1.25 2004.11.21.22.03.48 marcus
Edit ports/x11-toolkits/py-gnome2/Makefile
Add delta 1.78 2004.11.20.17.18.17 kwm
Edit ports/x11-toolkits/py-gnome2/distinfo
Add delta 1.28 2004.11.20.17.18.17 kwm
Edit ports/x11-toolkits/py-gnome2/pkg-plist
Add delta 1.31 2004.11.20.17.18.17 kwm
Updating collection ports-x11-wm/cvs
Shutting down connection to server
Finished successfully
$ exit
--
Presumably you've also nohup -ed the background job too:-)
anyway have a look at 'screen' to give you virtual terminals that you 
drop out of and back into when you want to.
---
yes screen will do that, detach first before logout, then re-attach when 
you want o get back to that session. Also no need to background the job, 
as screen will just keep the job running after detach anyway..

--
###This was the one I liked the most Rae###
From work:
# nohup foobar  foobar.log 
Back home:
# tail -f foobar.log
Ruben

If all you want to do is inspect the output from your command, then
simply use script(1) to save a transcript of the output.  script(1)
comes with the system.  Use it like this:
   % cd /usr/ports/x11/xorg
   % script /tmp/make.out  sudo make install
And /tmp/make.out will contain a transcript of everything that appears
on your screen during the course of doing that job.
   Cheers,
   Matthew
---
Thanks
# nohup foobar  foobar.log 
    ^^^
Why'd you do it like that, how is it diffrent from this way?:
# nohup foobar  foobar.log 
---
His example redirects both stdout and stderr to foobar.log, while yours
only redirect stdout. (Note that  is a csh-specific operator. The
equivalent for a Bourne-shell derivative would be:
nohup foobar  foobar.log 21 
I.e. redirecting stdout to foobar.log and then redirecting file
descriptor 2 (stderr) to wherever file descriptor 1 (stdout) goes to
(foobar.log in this case.)
When used with the nohup command I believe the redirection of stderr
is unnecessary since the manpage for nohup(1) says If standard error is a
terminal, it is directed to the same place as the standard output.
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: How can I make a program keep running even after I logout?

2004-12-15 Thread Rae Kim
Thank you all guys..

I've tried daemon, nohup and Nicolas' csh method

all works fine.

On Wed, 15 Dec 2004 13:42:52 -0600, Nikolas Britton
[EMAIL PROTECTED] wrote:

 Hi Rae, I asked this very same question back in (Job Control) back in
 November, first thing to know is that the default for the csh shell is
 not to hangup background jobs when you exit the shell. here is all the
 meat from that tread:
 
 ###This is the way I thought up on my own Rae###
 $ ssh localhost
 Password: 
 Last login: Mon Nov 22 06:13:59 2004 from localhost
 Copyright (c) 1980, 1983, 1986, 1988, 1990, 1991, 1993, 1994
The Regents of the University of California.  All rights reserved.
 
 FreeBSD 5.3-RELEASE-p1 (SPECTRA) #0: Sat Nov 20 23:30:17 CST 2004
 
 Welcome to FreeBSD!
 
 $ su
 Password: 
 spectra# cvsup -g -L 2 /root/ports-supfile  /root/ports-supfile.log
 [1] 71669
 spectra# exit
 exit
 $ exit
 Connection to localhost closed.
 $ tail /root/ports-supfile.log
  Add delta 1.25 2004.11.21.22.03.48 marcus
 Edit ports/x11-toolkits/py-gnome2/Makefile
  Add delta 1.78 2004.11.20.17.18.17 kwm
 Edit ports/x11-toolkits/py-gnome2/distinfo
  Add delta 1.28 2004.11.20.17.18.17 kwm
 Edit ports/x11-toolkits/py-gnome2/pkg-plist
  Add delta 1.31 2004.11.20.17.18.17 kwm
 Updating collection ports-x11-wm/cvs
 Shutting down connection to server
 Finished successfully
 $ exit
 --
 Presumably you've also nohup -ed the background job too:-)
 
 anyway have a look at 'screen' to give you virtual terminals that you
 drop out of and back into when you want to.
 ---
 yes screen will do that, detach first before logout, then re-attach when
 you want o get back to that session. Also no need to background the job,
 as screen will just keep the job running after detach anyway..
 
 --
 ###This was the one I liked the most Rae###
  From work:
 # nohup foobar  foobar.log 
 
 Back home:
 # tail -f foobar.log
 
 Ruben
 
 If all you want to do is inspect the output from your command, then
 simply use script(1) to save a transcript of the output.  script(1)
 comes with the system.  Use it like this:
 
 % cd /usr/ports/x11/xorg
 % script /tmp/make.out  sudo make install
 
 And /tmp/make.out will contain a transcript of everything that appears
 on your screen during the course of doing that job.
 
 Cheers,
 
 Matthew
 ---
 Thanks
 
 # nohup foobar  foobar.log 
      ^^^
 
 Why'd you do it like that, how is it diffrent from this way?:
 # nohup foobar  foobar.log 
 ---
 His example redirects both stdout and stderr to foobar.log, while yours
 only redirect stdout. (Note that  is a csh-specific operator. The
 equivalent for a Bourne-shell derivative would be:
  nohup foobar  foobar.log 21 
 I.e. redirecting stdout to foobar.log and then redirecting file
 descriptor 2 (stderr) to wherever file descriptor 1 (stdout) goes to
 (foobar.log in this case.)
 
 When used with the nohup command I believe the redirection of stderr
 is unnecessary since the manpage for nohup(1) says If standard error is a
 terminal, it is directed to the same place as the standard output.

___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: How can I make a program keep running even after I logout?

2004-12-15 Thread Nikolas Britton
Rae Kim wrote:
Thank you all guys..
I've tried daemon, nohup and Nicolas' csh method
all works fine.
 

My way isn't a csh way it's just that I use csh as my default shell and 
was just stating the fact that with csh background jobs do not die when 
you exit, so the nohup is optional (but recommend) with csh.

The way I do it is a hybrid of my own method I thought up and Rubens method:
# nohup foobar  foobar.log
nohup is to ingore the SIGUP signal, foobar is your command you want to run,  is to redirect output from 
stdout (the console) to a file, foobar.log is the file you're redirecting output to,  is to background the job.

example: nohup cvsup -g -L 2 /root/ports-supfile  /root/ports-supfile.log
---
# tail -f foobar.log
tail displays the end of a file (are log file), the -f flag causes tail to not stop when 
end of file is reached, but rather to wait for additional data to be appended to the input, 
foobar.log this is are log file from are backgrounded job above.
example: tail -f /root/ports-supfile.log
So what tail -f essentially does is bring are background job back to the 
foreground by redirecting the output from the command back to stdout. This mean 
that if we're on a remote connection and the link die the program will stay 
running and we can just login again and start where we left off, or if we get 
back home/work/school/where we can still watch whats happening in realtime.
I just had an idea... Is there a way to redirect stdin to a file or redirect 
stdin to a file and have are job use this file for stdin? if this is was 
possible we could interact with are background job from any remote or local 
terminal, this could be a security risk though because anyone could interact 
with it?.
So anyways... The beauty of this is that we're using standard unix stuff so you 
can do this from any *nix box and from any shell.
---
###My (old) Way###
$ ssh localhost
Password: 
Last login: Mon Nov 22 06:13:59 2004 from localhost
Copyright (c) 1980, 1983, 1986, 1988, 1990, 1991, 1993, 1994
  The Regents of the University of California.  All rights reserved.
FreeBSD 5.3-RELEASE-p1 (SPECTRA) #0: Sat Nov 20 23:30:17 CST 2004
Welcome to FreeBSD!
$ su
Password: 
spectra# cvsup -g -L 2 /root/ports-supfile  /root/ports-supfile.log
[1] 71669
spectra# exit
exit
$ exit
Connection to localhost closed.
$ tail /root/ports-supfile.log
Add delta 1.25 2004.11.21.22.03.48 marcus
Edit ports/x11-toolkits/py-gnome2/Makefile
Add delta 1.78 2004.11.20.17.18.17 kwm
Edit ports/x11-toolkits/py-gnome2/distinfo
Add delta 1.28 2004.11.20.17.18.17 kwm
Edit ports/x11-toolkits/py-gnome2/pkg-plist
Add delta 1.31 2004.11.20.17.18.17 kwm
Updating collection ports-x11-wm/cvs
Shutting down connection to server
Finished successfully
$ exit
###Rubens Way###
From work:
# nohup foobar  foobar.log 
Back home:
# tail -f foobar.log
Ruben

Thanks
# nohup foobar  foobar.log 
    ^^^
Why'd you do it like that, how is it diffrent from this way?:
# nohup foobar  foobar.log 
-
His example redirects both stdout and stderr to foobar.log, while yours
only redirect stdout. (Note that  is a csh-specific operator. The
equivalent for a Bourne-shell derivative would be:
nohup foobar  foobar.log 21 
I.e. redirecting stdout to foobar.log and then redirecting file
descriptor 2 (stderr) to wherever file descriptor 1 (stdout) goes to
(foobar.log in this case.)
When used with the nohup command I believe the redirection of stderr
is unnecessary since the manpage for nohup(1) says If standard error is a
terminal, it is directed to the same place as the standard output.
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: How can I make a program keep running even after I logout?

2004-12-15 Thread Giorgos Keramidas
On 2004-12-15 13:33, Rae Kim [EMAIL PROTECTED] wrote:
 I connect to my computer from school computer.
 I want to cvsup or/and portupgrade and logout but the program keep running?

Put it in the background.  Optionally, you may wish to redirect its
output to a file and use tail -f on that file to see how things are
progressing:

bash-2.05b$ ( cvsup -g -L 2 -h cvsup.example.net  logfile 21 ) 
bash-2.05b$ disown %1
bash-2.05b$ exit

The example shown above works for GNU bash, hence the prompt.  Other
shells have ways of doing the same thing too.

- Giorgos

___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


RE: How can I make a program keep running even after I logout?

2004-12-15 Thread Subhro
Man nohup

Indian Institute of Information Technology
Subhro Sankha Kar
Block AQ-13/1, Sector V
Salt Lake City
PIN 700091
India
 -Original Message-
 From: [EMAIL PROTECTED] [mailto:owner-freebsd-
 [EMAIL PROTECTED] On Behalf Of Rae Kim
 Sent: Thursday, December 16, 2004 0:03
 To: [EMAIL PROTECTED]
 Subject: How can I make a program keep running even after I logout?
 
 I connect to my computer from school computer.
 
 I want to cvsup or/and portupgrade and logout but the program keep
 running?
 ___
 [EMAIL PROTECTED] mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-questions
 To unsubscribe, send any mail to freebsd-questions-
 [EMAIL PROTECTED]


smime.p7s
Description: S/MIME cryptographic signature


Re: How can I make a program keep running even after I logout?

2004-12-15 Thread Mat Kovach
On Wed, Dec 15, 2004 at 07:40:02PM +0100, Nico Meijer wrote:
 Hi,
 
  I want to cvsup or/and portupgrade and logout but the program keep
  running?
 
 Try screen: /usr/ports/misc/screen
 
 To run it, simply type `screen`, do your work, type Ctrl-A d to detach
 (you can go home now). Log in again, type `screen -r`. Be happy.

You can also use nohup 

man 1 nohup

But screen is an excellent choice also but might be over kill 
for this specific purpose.

I use something like:

$ nohup sudo cvsup -g -L 2 /etc/cvsupdate 
appending output to /home/kovachme/nohup.out

-- 
Mat Kovach
Cleveland, Ohio
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: How can I make a program keep running even after I logout?

2004-12-15 Thread Miguel Mendez
On Wed, 15 Dec 2004 13:33:00 -0500
Rae Kim [EMAIL PROTECTED] wrote:

Hi,

 I connect to my computer from school computer.
 
 I want to cvsup or/and portupgrade and logout but the program keep
 running?

You can use misc/screen for that, let's you attach/detach a screen while
programs keep running inside that session. I use it to keep an irc
client idling 7/24 :)

Cheers,
-- 
Miguel Mendez [EMAIL PROTECTED] | lea gfx_lib(pc),a1
http://www.energyhq.es.eu.org| moveq   #0,d0
PGP Key: 0xDC8514F1  | move.l  4.w,a6
Note: All HTML mail goes to /dev/null| jsr -552(a6)



pgpUXj693xGe7.pgp
Description: PGP signature


Re: How can I make a program keep running even after I logout?

2004-12-15 Thread Nico Meijer
Hi,

 I want to cvsup or/and portupgrade and logout but the program keep
 running?

Try screen: /usr/ports/misc/screen

To run it, simply type `screen`, do your work, type Ctrl-A d to detach
(you can go home now). Log in again, type `screen -r`. Be happy.

HTH... Nico
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]