PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Serveur - Sécurité et techniques > comp.unix.shell > How to put a command over SSH in background ?
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
comp.unix.shell Using and programming the Unix shell.

How to put a command over SSH in background ?

Réponse
 
LinkBack Outils de la discussion
Vieux 06/05/2008, 22h20   #1
Sabine Elsner
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut How to put a command over SSH in background ?

Assume I opened a SSH session to a remote Linux server.

I want to start a long running command on that remote system and put that command in background
so that I can logout (from SSH session) while the command is still running and not aborted.

Normally I would have to put the command in such a case in background by appending a " &" at the end
of the command line. However this does not work if I redirect the output like in:

rsync ...... >>logfile 2>&1 &

I guess I have to mask the appended "&".

How do I do this otherwise?

Sabine
  Réponse avec citation
Vieux 06/05/2008, 22h49   #2
Robert Heller
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: How to put a command over SSH in background ?

At 06 May 2008 21:20:51 GMT gizmo_3@yahoo.de (Sabine Elsner) wrote:

>
> Assume I opened a SSH session to a remote Linux server.
>
> I want to start a long running command on that remote system and put that command in background
> so that I can logout (from SSH session) while the command is still running and not aborted.
>
> Normally I would have to put the command in such a case in background by appending a " &" at the end
> of the command line. However this does not work if I redirect the output like in:
>
> rsync ...... >>logfile 2>&1 &
>
> I guess I have to mask the appended "&".
>
> How do I do this otherwise?


ssh remote.machine.whatever sh -c 'nohup rsync ...... >>logfile 2>&1 &'

Note: 'logfile' lives on the remote machine's file system. You have to
quote the whole command string and pass it to a 'super' shell, one that
will exit once the background job fades into the background. nohup
prevents the forked process from being killed when the parent (super)
shell exits.

>
> Sabine
>


--
Robert Heller -- Get the Deepwoods Software FireFox Toolbar!
Deepwoods Software -- Linux Installation and Administration
http://www.deepsoft.com/ -- Web Hosting, with CGI and Database
heller@deepsoft.com -- Contract Programming: C/C++, Tcl/Tk

  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 08h33.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,07443 seconds with 10 queries