Re: Running script after logging out of SSH
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
|