|
|
|
|
||||||
| comp.unix.shell Using and programming the Unix shell. |
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
Hi,
I'm using Fedora Core Linux 6 and currently using zsh, but I can change shells. What I'm wondering is how I would execute a script after I have logged out via SSH. My normal way of working is to use Putty on my Windows XP machine to SSH in to my Linux box. When I click "exit" from Putty when logged in as user "me", I would like to run a script that backs up certain files. Thanks, - Dave |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
On Mon, 24 Mar 2008 14:14:20 -0700, laredotornado wrote:
> I'm using Fedora Core Linux 6 and currently using zsh, but I can change > shells. What I'm wondering is how I would execute a script after I have > logged out via SSH. My normal way of working is to use Putty on my > Windows XP machine to SSH in to my Linux box. When I click "exit" from > Putty when logged in as user "me", I would like to run a script that > backs up certain files. The "man zsh" page indicates that you want the executable script as a command in $HOME/.zlogout. I doubt that the file will be parsed if you exit PuTTY in the manner you state, so you should exit the zsh by typing "exit" in the window, rather than the GUI exit you state. You'll have to experiment to verify that behaviour. |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
laredotornado schreef:
> Hi, > > I'm using Fedora Core Linux 6 and currently using zsh, but I can > change shells. What I'm wondering is how I would execute a script > after I have logged out via SSH. My normal way of working is to use > Putty on my Windows XP machine to SSH in to my Linux box. When I > click "exit" from Putty when logged in as user "me", I would like to > run a script that backs up certain files. > > Thanks, - Dave type: $ man zsh and search for 'logout' (by typeing '/logout'...) you'll find the info there -- Luuk |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
On 24 mar, 22:14, laredotornado <laredotorn...@zipmail.com> wrote:
> Hi, > > I'm using Fedora Core Linux 6 and currently using zsh, but I can > change shells. What I'm wondering is how I would execute a script > after I have logged out via SSH. My normal way of working is to use > Putty on my Windows XP machine to SSH in to my Linux box. When I > click "exit" from Putty when logged in as user "me", I would like to > run a script that backs up certain files. > > Thanks, - Dave You could use .bash_logout (or zsh equivalent ?) feature. I'm not sure about its use on .bash_logout, but 'nohup' command could tu run your commands. |
|
|
|
#5 |
|
Messages: n/a
Hébergeur: |
On Mar 24, 6:16pm, Luuk <L...@invalid.lan> wrote:
> laredotornadoschreef: > > > Hi, > > > I'm using Fedora Core Linux 6 and currently using zsh, but I can > > change shells. What I'm wondering is how I would execute a script > > after I have logged out via SSH. My normal way of working is to use > > Putty on my Windows XP machine to SSH in to my Linux box. When I > > click "exit" from Putty when logged in as user "me", I would like to > > run a script that backs up certain files. > > > Thanks, - Dave > > type: > $ man zsh > > and search for 'logout' > (by typeing '/logout'...) > you'll find the info there > > -- > Luuk So the file is ~/.zlogout. Thanks to the group for that one. Here's a follow up. My .zlogout file consists of nohup sh /opt/scripts/backup_web.sh As I said, I'm logged in through PuTTy on Windows XP, but when I exit, like below, the window doesn't close, instead it just hangs on the last line: [me@mymachine]/opt/scripts% exit nohup: appending output to `/home/me/nohup.out' Is there a way to have the process run in the background AND logout so that the PuTTY window closes? - Dave |
|
|
|
#6 |
|
Messages: n/a
Hébergeur: |
On Wed, 26 Mar 2008 13:00:42 -0700 (PDT), laredotornado
<laredotornado@zipmail.com> wrote: >On Mar 24, 6:16pm, Luuk <L...@invalid.lan> wrote: >> laredotornadoschreef: >> >> > Hi, >> >> > I'm using Fedora Core Linux 6 and currently using zsh, but I can >> > change shells. What I'm wondering is how I would execute a script >> > after I have logged out via SSH. My normal way of working is to use >> > Putty on my Windows XP machine to SSH in to my Linux box. When I >> > click "exit" from Putty when logged in as user "me", I would like to >> > run a script that backs up certain files. >> >> > Thanks, - Dave >> >> type: >> $ man zsh >> >> and search for 'logout' >> (by typeing '/logout'...) >> you'll find the info there >> >> -- >> Luuk > >So the file is ~/.zlogout. Thanks to the group for that one. Here's >a follow up. My .zlogout file consists of > >nohup sh /opt/scripts/backup_web.sh > >As I said, I'm logged in through PuTTy on Windows XP, but when I exit, >like below, the window doesn't close, instead it just hangs on the >last line: > >[me@mymachine]/opt/scripts% exit >nohup: appending output to `/home/me/nohup.out' > >Is there a way to have the process run in the background AND logout so >that the PuTTY window closes? - Dave Append " &" to that line: nohup sh /opt/scripts/backup_web.sh & Scott McMillan |
|
|
|
#7 |
|
Messages: n/a
Hébergeur: |
On 2008-03-26, laredotornado <laredotornado@zipmail.com> wrote:
> On Mar 24, 6:16pm, Luuk <L...@invalid.lan> wrote: >> >> type: >> $ man zsh >> >> and search for 'logout' >> (by typeing '/logout'...) >> you'll find the info there >> >> -- >> Luuk > > So the file is ~/.zlogout. Thanks to the group for that one. Here's > a follow up. My .zlogout file consists of > > nohup sh /opt/scripts/backup_web.sh > > As I said, I'm logged in through PuTTy on Windows XP, but when I exit, > like below, the window doesn't close, instead it just hangs on the > last line: > > [me@mymachine]/opt/scripts% exit > nohup: appending output to `/home/me/nohup.out' You need an ampersand after the nohup command: nohup sh /opt/scripts/backup_web.sh & I missed the beginning of this thread so I don't know if you were using zsh anyway. You can do the same thing with any sh compatible shell via the trap command in the login shell (e.g. via .profile): trap "/command/to/execute -options" 0 -- Andrew Smallshaw andrews@sdf.lonestar.org |
|
![]() |
| Outils de la discussion | |
|
|