ComposantsComponents › SystèmeSystem
Exécute des commandes via SSH : il se connecte à un serveur, y lance une ou plusieurs commandes et attend qu'elles se terminent. Leur sortie standard et leur sortie d'erreur vont dans la console du job, dans des variables globales ou dans un flux ; le code de retour est rangé dans une variable globale. Le client SSH est celui d'Apache MINA SSHD 2.9.2. Pour une commande sur la machine même du job, prenez un tSystem. Executes commands through SSH: it connects to a server, runs one or more commands there and waits for them to end. Their standard output and error output go to the job console, to global variables or to a flow; the exit code is stored in a global variable. The SSH client is the one of Apache MINA SSHD 2.9.2. For a command on the machine of the job itself, take a tSystem.
EntréeInput
Aucune : il peut commencer un sous-job. Sinon un lien Main (les commandes sont lancées pour chaque ligne et peuvent utiliser ses colonnes) ou Iterate (une exécution par itération). None: it can start a subjob. Otherwise one Main link (the commands are run for each row and can use its columns) or Iterate link (one run per iteration).
SortieOutput
Un lien Main. Avec une sortie à normal : une ligne par sortie, qui contient toute la sortie, dans outputline. Avec un flux d'entrée, les lignes reçues sont transmises.
One Main link. With an output set to normal: one row per output, holding the whole output, in outputline. With an input flow, the received rows are passed on.
Déclencheurs en sortieOutput triggers
On Subjob Ok On Subjob Error On Component Ok On Component Error Run if
Un script lancé sur le serveur (préparer un fichier, relancer un service), puis un arrêt si son code de retour n'est pas 0. Écrivez la condition !Integer.valueOf(0).equals(globalMap.get("tSSH_1_EXIT_CODE")) : elle est vraie aussi quand le code manque (voir Variables globales).
A script run on the server (prepare a file, restart a service), then a stop if its exit code is not 0. Write the condition !Integer.valueOf(0).equals(globalMap.get("tSSH_1_EXIT_CODE")): it is also true when the code is missing (see Global variables).
Avec la sortie standard à normal, la sortie de la commande arrive dans la colonne outputline : une seule ligne pour toute la sortie, ses lignes séparées par \n, contrairement au tSystem.
With the standard output set to normal, the output of the command arrives in the outputline column: a single row for the whole output, its lines separated by \n, unlike the tSystem.
EXIT_CODE) : une commande en échec n'arrête pas le job.
Choose where Standard Output and Error Output go, then test the exit code (EXIT_CODE): a failed command does not stop the job.
Les libellés sont ceux de l'onglet Composant, dans son ordre ; le nom technique, en gris, est celui du paramètre dans le fichier du job. Le composant n'a pas de paramètres avancés propres. Labels are those of the Component tab, in its order; the technical name, in grey, is the parameter name in the job file. The component has no advanced settings of its own.
| ParamètreSetting | DéfautDefault | VisibleShown | Description |
|---|---|---|---|
| SchémaSchemaSCHEMA | vide ; outputline si une sortie vaut normalempty; outputline when an output is normal |
ToujoursAlways |
La colonne outputline (String, longueur 255, en lecture seule) reçoit la sortie quand une des sorties vaut normal. Avec un flux d'entrée, ajoutez ses colonnes : elles sont recopiées de chaque ligne reçue.
The outputline column (String, length 255, read-only) receives the output when one of the outputs is normal. With an input flow, add its columns: they are copied from each received row.
|
| HôteHostHOST | "ssh_server" |
ToujoursAlways |
Nom ou adresse du serveur, entre guillemets : "server.example.com", context.sshHost. Un nom défini dans le fichier ~/.ssh/config du compte qui lance le job est résolu par ce fichier (voir Sécurité).
Name or address of the server, in quotes: "server.example.com", context.sshHost. A name defined in the ~/.ssh/config file of the account that runs the job is resolved through that file (see Security).
|
| PortPORT | 22 |
ToujoursAlways |
Port SSH du serveur. Le code généré écrit Integer.parseInt(port + "") : un nombre ou une expression de type texte (variable de contexte String) conviennent.
SSH port of the server. The generated code writes Integer.parseInt(port + ""): a number or a text expression (String context variable) both work.
|
| UtilisateurUserUSER | "USERNAME" |
ToujoursAlways | Compte sur le serveur. Les commandes s'exécutent avec ses droits, par son shell, en général depuis son dossier personnel. Account on the server. The commands run with its rights, through its shell, usually from its home folder. |
| Méthode d'authentificationAuthentication methodAUTH_METHOD | Mot de passePassword | ToujoursAlways | Clé publique, Mot de passe ou Clavier interactif. Voir L'authentification. Public key, Password or Keyboard Interactive. See Authentication. |
| Mot de passePasswordPASSWORD | "secret" |
Mot de passe ou Clavier interactifPassword or Keyboard Interactive |
Mot de passe du compte. Une valeur entre guillemets est chiffrée dans le code généré ; une expression (context.sshPassword) est reprise telle quelle.
Password of the account. A value in quotes is encrypted in the generated code; an expression (context.sshPassword) is used as is.
|
| Phrase secrète cléKey PassphrasePASSPHRASE | "secret" |
Clé publiquePublic key | Phrase qui déchiffre la clé privée. Ignorée pour une clé qui n'est pas chiffrée : la valeur par défaut peut rester. Phrase that decrypts the private key. Ignored for a key that is not encrypted: the default value can stay. |
| Pseudo terminalPseudo TerminalPTY | NonNo | ToujoursAlways |
Décochée : les commandes partent en une seule ligne de commande. Cochée : elles sont écrites une à une dans un shell interactif avec terminal, suivies de exit. Voir Les commandes.
Unchecked: the commands go as a single command line. Checked: they are written one by one into an interactive shell with a terminal, followed by exit. See The commands.
|
| Clé privéePrivate keyPRIVATEKEY | "/.ssh/id_dsa" |
Clé publiquePublic key | Fichier de la clé privée, sur la machine du job. Il est lu au début du composant, avant la connexion. Clés RSA et ECDSA lues ; Ed25519 refusée. File of the private key, on the machine of the job. It is read at the start of the component, before the connection. RSA and ECDSA keys read; Ed25519 rejected. |
| Séparateur de commandesCommand SeparatorCOMMANDSEPARATOR | ";" |
Pseudo terminal décochéPseudo Terminal unchecked |
Texte placé entre deux commandes de la table. C'est le shell distant qui l'interprète : ";" ou " && " pour sh/bash, " & " pour cmd.exe.
Text put between two commands of the table. The remote shell interprets it: ";" or " && " for sh/bash, " & " for cmd.exe.
|
| CommandesCommandsCOMMANDS | "echo Talaxie Open Studio" |
ToujoursAlways |
Une colonne Commande, une expression Java de type texte par ligne : "ls /data/in", "gzip " + context.file, "echo " + row1.name avec un flux d'entrée.
One Command column, one Java expression of type text per row: "ls /data/in", "gzip " + context.file, "echo " + row1.name with an input flow.
|
| Utiliser le délai avant expirationUse timeoutUSE_TIMEOUT | NonNo | ToujoursAlways | Décochée : aucune limite, une commande qui ne se termine pas bloque le job. Cochée : voir Délai avant expiration en secondes. Unchecked: no limit, a command that does not end blocks the job. Checked: see Timeout in seconds. |
| Délai avant expiration en secondesTimeout in secondsTIMEOUT | 60 |
Utiliser le délai cochéUse timeout checked |
Sert trois fois : attente de la connexion, ouverture du terminal (pseudo terminal) et surtout inactivité de la session. Si rien ne passe pendant ce délai, la session est fermée sans erreur : le job continue avec la sortie reçue jusque-là et un EXIT_CODE vide (voir Pièges).
Used three times: wait for the connection, opening of the terminal (pseudo terminal) and above all inactivity of the session. If nothing goes through during this time, the session is closed without an error: the job goes on with the output received so far and an empty EXIT_CODE (see Pitfalls).
|
| Sortie standardStandard OutputSTANDARDOUTPUT | vers la consoleto console | ToujoursAlways |
vers la console : la sortie est écrite dans la console du job à la fin du composant. vers la variable globale : rangée dans STDOUT. vers la console et vers la variable globale : les deux. normal : une ligne du flux de sortie, colonne outputline.
to console: the output is written to the job console at the end of the component. to global variable: stored in STDOUT. to both console and global variable: both. normal: one row of the output flow, outputline column.
|
| Sortie des erreursError OutputERROROUTPUT | vers la consoleto console | ToujoursAlways |
Les mêmes choix pour la sortie d'erreur de la commande, avec la variable STDERR. vers la console l'écrit sur la sortie standard du job, après la sortie standard de la commande.
The same choices for the error output of the command, with the STDERR variable. to console writes it to the standard output of the job, after the standard output of the command.
|
Toutes trois disponibles après le composant : All three available after the component:
14 si l'authentification échoue. null si la session s'est fermée avant que le serveur l'envoie (délai d'inactivité) ou si la connexion a échoué.Integer, Exit value: the exit code of the command line (of the last command run), or of the shell with the pseudo terminal. 14 when the authentication fails. null when the session closed before the server sent it (inactivity timeout) or when the connection failed.null sinon. Lignes séparées par \n, sans saut de ligne final.String, Standard Output: only when it goes to the global variable; null otherwise. Lines separated by \n, with no final line break.((Integer) globalMap.get("tSSH_1_EXIT_CODE"))
((String) globalMap.get("tSSH_1_STDOUT"))
((String) globalMap.get("tSSH_1_STDERR"))
Comme EXIT_CODE peut être null, une condition ((Integer) globalMap.get("tSSH_1_EXIT_CODE")) != 0 lève alors une NullPointerException ; préférez !Integer.valueOf(0).equals(globalMap.get("tSSH_1_EXIT_CODE")). Sur une erreur, le message est aussi dans tSSH_1_ERROR_MESSAGE, comme pour tout composant.
As EXIT_CODE can be null, a condition ((Integer) globalMap.get("tSSH_1_EXIT_CODE")) != 0 then throws a NullPointerException; prefer !Integer.valueOf(0).equals(globalMap.get("tSSH_1_EXIT_CODE")). On an error, the message is also in tSSH_1_ERROR_MESSAGE, as for any component.
Ce que fait chaque méthode, lu dans le modèle du composant, et ce qu'ont donné nos essais avec un serveur SSH d'essai (Apache MINA SSHD). What each method does, read in the template of the component, and what our runs gave with a test SSH server (Apache MINA SSHD).
| MéthodeMethod | Ce que fait le composantWhat the component does | Lors de nos essaisIn our runs |
|---|---|---|
| Mot de passePassword | Donne le mot de passe au client SSH, sans restreindre ses méthodes : si le serveur propose aussi keyboard-interactive, le client peut y répondre avec ce mot de passe.Gives the password to the SSH client, without restricting its methods: if the server also offers keyboard-interactive, the client can answer it with this password. | Accepté par un serveur qui n'offre que password. Avec un serveur qui offre aussi keyboard-interactive, c'est cette méthode que le client a utilisée.Accepted by a server that only offers password. With a server that also offers keyboard-interactive, the client used that method. |
| Clavier interactifKeyboard Interactive | Seule la méthode keyboard-interactive. Chaque question du serveur reçoit pour réponse le Mot de passe : un serveur qui pose une autre question (code à usage unique) ne peut pas être satisfait.Only the keyboard-interactive method. Each question of the server gets the Password as answer: a server that asks another question (one-time code) cannot be satisfied. | Accepté par un serveur qui demande le mot de passe. Refusé (Authentication failed.) par un serveur qui n'offre que password.Accepted by a server that asks for the password. Rejected (Authentication failed.) by a server that only offers password. |
| Clé publiquePublic key | Seule la méthode publickey, avec la clé du fichier Clé privée, déchiffrée par la Phrase secrète clé si besoin. La clé publique correspondante doit être dans ~/.ssh/authorized_keys du compte distant.Only the publickey method, with the key of the Private key file, decrypted by the Key Passphrase when needed. The matching public key must be in ~/.ssh/authorized_keys of the remote account. |
Acceptées : ECDSA (format OpenSSH, sans phrase secrète), RSA (format OpenSSH, avec phrase secrète), RSA (format PEM). Refusée avant toute connexion : Ed25519, type que propose par défaut ssh-keygen depuis OpenSSH 9.5 ; la bibliothèque SSH du job ne le lit pas.Accepted: ECDSA (OpenSSH format, no passphrase), RSA (OpenSSH format, with passphrase), RSA (PEM format). Rejected before any connection: Ed25519, the type that ssh-keygen offers by default since OpenSSH 9.5; the SSH library of the job does not read it. |
Pour créer une clé que le composant sait lire : ssh-keygen -t ecdsa -b 256 ou ssh-keygen -t rsa -b 3072. Les messages d'une authentification qui échoue sont dans Les erreurs.
To create a key that the component can read: ssh-keygen -t ecdsa -b 256 or ssh-keygen -t rsa -b 3072. The messages of a failed authentication are in Errors.
Les lignes de Commandes sont jointes par le Séparateur de commandes en une seule ligne, envoyée au serveur comme une commande à exécuter (canal exec). Le shell du compte distant la découpe : avec ; chaque commande s'exécute, avec && la suite s'arrête à la première qui échoue. EXIT_CODE est celui de la dernière commande exécutée.
The rows of Commands are joined by the Command Separator into a single line, sent to the server as a command to run (exec channel). The shell of the remote account splits it: with ; each command runs, with && the rest stops at the first one that fails. EXIT_CODE is the one of the last command run.
Un séparateur vide colle les commandes : "echo one" et "echo two" ont affiché oneecho two.
An empty separator glues the commands: "echo one" and "echo two" printed oneecho two.
Le composant ouvre un shell interactif avec terminal, y écrit chaque commande suivie d'un retour à la ligne, puis exit, et lit tout ce qui revient. Le séparateur est masqué et ignoré. EXIT_CODE est celui du shell : avec bash, celui de la dernière commande (une dernière commande ls en échec a donné 2).
The component opens an interactive shell with a terminal, writes each command into it followed by a line break, then exit, and reads everything that comes back. The separator is hidden and ignored. EXIT_CODE is the one of the shell: with bash, the one of the last command (a failing last ls command gave 2).
Ce que renvoie un terminal dépend du serveur : invite, écho des commandes ou message d'accueil peuvent s'ajouter à la sortie ; avec notre serveur d'essai, l'écho des commandes est arrivé dans STDERR. Les commandes sont envoyées dans l'encodage par défaut de Java, UTF-8 avec Java 21.
What a terminal sends back depends on the server: prompt, echo of the commands or welcome message can add to the output; with our test server, the echo of the commands arrived in STDERR. The commands are sent in the default encoding of Java, UTF-8 with Java 21.
Réglages montrés avec un serveur de documentation : Hôte "server.example.com", Port 22, Utilisateur "demo", Mot de passe. Les sorties sont copiées depuis des exécutions du job (lancé depuis Talaxie, Java 21) contre un serveur SSH d'essai installé sur le poste (Apache MINA SSHD, commandes passées à bash) ; le dossier du compte y contient data/customers.csv et data/orders.csv. Le tJava relié par On Subjob Ok est, sauf mention contraire :
Settings shown with a documentation server: Host "server.example.com", Port 22, User "demo", Password. The outputs are copied from runs of the job (started from Talaxie, Java 21) against a test SSH server installed on the machine (Apache MINA SSHD, commands given to bash); the folder of the account there holds data/customers.csv and data/orders.csv. The tJava connected with On Subjob Ok is, unless stated otherwise:
System.out.println("EXIT_CODE = " + globalMap.get("tSSH_1_EXIT_CODE"));
System.out.println("STDOUT = [" + globalMap.get("tSSH_1_STDOUT") + "]");
System.out.println("STDERR = [" + globalMap.get("tSSH_1_STDERR") + "]");
Commande : "echo Hello from tSSH", sorties par défaut.
Command: "echo Hello from tSSH", default outputs.
Hello from tSSH EXIT_CODE = 0 STDOUT = [null] STDERR = [null]
Vers la console, les variables STDOUT et STDERR restent vides.
To the console, the STDOUT and STDERR variables stay empty.
Commande : "ls data missing", qui liste data puis échoue sur missing. Sorties par défaut.
Command: "ls data missing", which lists data then fails on missing. Default outputs.
data: customers.csv orders.csv ls: cannot access 'missing': No such file or directory EXIT_CODE = 2 STDOUT = [null] STDERR = [null]
Le message d'erreur arrive après la sortie standard, sur la sortie standard du job (Talaxie l'affiche comme une ligne normale). Le job continue et se termine avec le code 0 : seul EXIT_CODE voit l'échec.
The error message arrives after the standard output, on the standard output of the job (Talaxie shows it as a normal line). The job goes on and ends with code 0: only EXIT_CODE sees the failure.
Même commande, les deux sorties vers la variable globale : la console ne montre que le tJava. Same command, both outputs to global variable: the console only shows the tJava.
EXIT_CODE = 2 STDOUT = [data: customers.csv orders.csv] STDERR = [ls: cannot access 'missing': No such file or directory]
Avec vers la console et vers la variable globale, les quatre lignes de la commande s'affichent d'abord, comme dans l'exemple précédent, puis les mêmes valeurs. With to both console and global variable, the four lines of the command are printed first, as in the previous example, then the same values.
Commande : "ls data", sortie standard normal, schéma outputline. Le tJava affiche en plus tLogRow_1_NB_LINE.
Command: "ls data", standard output normal, outputline schema. The tJava also prints tLogRow_1_NB_LINE.
customers.csv orders.csv EXIT_CODE = 0 STDOUT = [null] STDERR = [null] tLogRow_1 NB_LINE = 1
Les deux fichiers sont dans une ligne du flux (customers.csv\norders.csv). Avec les deux sorties à normal et "ls data missing", le flux a reçu deux lignes : la sortie standard puis la sortie d'erreur. Une sortie vide donne quand même sa ligne, vide. Pour une ligne du flux par ligne écrite, découpez outputline sur \n (tNormalize, par exemple).
Both files are in one row of the flow (customers.csv\norders.csv). With both outputs set to normal and "ls data missing", the flow received two rows: the standard output then the error output. An empty output still gives its row, empty. For one flow row per written line, split outputline on \n (tNormalize, for example).
Trois lignes dans Commandes : "echo one", "echo two", "echo three", séparateur ";". Le serveur reçoit echo one;echo two;echo three.
Three rows in Commands: "echo one", "echo two", "echo three", separator ";". The server receives echo one;echo two;echo three.
one two three EXIT_CODE = 0 STDOUT = [null] STDERR = [null]
Avec "ls missing" puis "echo two" et le séparateur " && ", la deuxième commande n'est pas lancée :
With "ls missing" then "echo two" and the separator " && ", the second command is not run:
ls: cannot access 'missing': No such file or directory EXIT_CODE = 2 STDOUT = [null] STDERR = [null]
Clé publique, Clé privée "C:/keys/id_rsa" (clé RSA au format OpenSSH, chiffrée), Phrase secrète clé renseignée. Commande : "echo Connected with a key" ; le tJava n'affiche que EXIT_CODE.
Public key, Private key "C:/keys/id_rsa" (RSA key in OpenSSH format, encrypted), Key Passphrase filled in. Command: "echo Connected with a key"; the tJava only prints EXIT_CODE.
Connected with a key EXIT_CODE = 0
Pseudo terminal coché, commandes "cd data" puis "ls", sorties vers la variable globale ; le tJava affiche EXIT_CODE et STDOUT.
Pseudo Terminal checked, commands "cd data" then "ls", outputs to global variable; the tJava prints EXIT_CODE and STDOUT.
EXIT_CODE = 0 STDOUT = [customers.csv orders.csv]
Les commandes s'enchaînent dans le même shell : ls s'exécute dans data. Sans pseudo terminal, cd data;ls a donné la même sortie. Le serveur d'essai renvoyait en plus l'écho des commandes dans STDERR.
The commands follow one another in the same shell: ls runs in data. Without a pseudo terminal, cd data;ls gave the same output. The test server also sent back the echo of the commands in STDERR.
tLoop de 1 à 2, sortie standard vers la console et vers la variable globale, et un tJava relié au tLoop par On Subjob Ok. tLoop from 1 to 2, standard output to both console and global variable, and a tJava connected to the tLoop with On Subjob Ok.
// tSSH_1 › Commandes / Commands
"echo Iteration " + globalMap.get("tLoop_1_CURRENT_VALUE")
// tJava_1
System.out.println("After the loop: STDOUT = [" + globalMap.get("tSSH_1_STDOUT") + "]");
Iteration 1 Iteration 2 After the loop: STDOUT = [Iteration 2]
Chaque itération ouvre et ferme sa connexion ; la variable ne garde que la dernière sortie. Avec un flux d'entrée, ce n'est pas le cas (voir Pièges). Each iteration opens and closes its connection; the variable only keeps the last output. With an input flow, this is not the case (see Pitfalls).
Messages relevés dans la console (première ligne de l'exception, chemins et adresse remplacés). Une exception arrête le job avec le code 1, sauf si un lien On Component Error ou On Subjob Error la reprend. Messages seen in the console (first line of the exception, paths and address replaced). An exception stops the job with code 1, unless an On Component Error or On Subjob Error link takes it over.
| CasCase | Message | EXIT_CODE |
|---|---|---|
| Mot de passe refusé (Mot de passe ou Clavier interactif)Password rejected (Password or Keyboard Interactive) | java.lang.IllegalArgumentException: Authentication failed. |
14 |
| Phrase secrète fausse (clé au format OpenSSH)Wrong passphrase (key in OpenSSH format) | java.io.StreamCorruptedException: Mismatched private key check values (…) in C:\keys\id_rsa |
null |
| Clé Ed25519Ed25519 key | java.security.NoSuchAlgorithmException: Unsupported key type (ssh-ed25519) in C:\keys\id_ed25519 |
null |
| Fichier de clé absentKey file missing | java.nio.file.NoSuchFileException: C:\keys\id_rsa |
null |
| Rien n'écoute sur le portNothing listens on the port | org.apache.sshd.common.SshException: DefaultConnectFuture[demo@…]: Failed (IOException) to execute: …, la fin venant du système dans sa langue (Le système distant a refusé la connexion réseau)org.apache.sshd.common.SshException: DefaultConnectFuture[demo@…]: Failed (IOException) to execute: …, the end coming from the system in its language (Le système distant a refusé la connexion réseau on a French Windows) |
null |
| Commande en échecFailing command | aucun : le job continuenone: the job goes on | le code de la commandethe code of the command |
| Délai d'inactivité dépasséInactivity timeout reached | aucun : le job continuenone: the job goes on | null |
tSSH_1 suivi d'un tJava par On Subjob Ok seulement. Nom du job remplacé par MyJob, pile abrégée :
tSSH_1 followed by a tJava through On Subjob Ok only. Job name replaced with MyJob, shortened stack:
Exception in component tSSH_1 (MyJob) java.lang.IllegalArgumentException: Authentication failed. at demo.myjob_0_1.MyJob.tSSH_1Process(MyJob.java:451) …
Le tJava n'est pas exécuté ; le job se termine avec le code 1. The tJava is not run; the job ends with code 1.
System.out.println("EXIT_CODE = " + globalMap.get("tSSH_1_EXIT_CODE"));
System.out.println("ERROR_MESSAGE = " + globalMap.get("tSSH_1_ERROR_MESSAGE"));
Après la même exception dans la console : After the same exception in the console:
EXIT_CODE = 14 ERROR_MESSAGE = Authentication failed.
Le tJava relié par On Subjob Ok n'est pas exécuté ; le job s'est terminé avec le code 0. 14 est le code SSH « plus de méthode d'authentification disponible ».
The tJava connected with On Subjob Ok is not run; the job ended with code 0. 14 is the SSH code "no more authentication methods available".
Le composant crée le client SSH avec les réglages par défaut de la bibliothèque (SshClient.setUpDefaultClient()) et ne lui donne aucun vérificateur de clé d'hôte : celui de la bibliothèque, AcceptAllServerKeyVerifier, accepte n'importe quelle clé. Le fichier known_hosts n'est pas consulté : lors de nos essais, une clé fausse enregistrée pour le serveur dans le ~/.ssh/known_hosts du compte n'a pas empêché la connexion. La bibliothèque écrit seulement un avertissement dans le journal du job (niveau WARN, Server at … presented unverified … key), que la console n'a pas affiché. Aucun réglage du composant ne change cela.
The component creates the SSH client with the default settings of the library (SshClient.setUpDefaultClient()) and gives it no host key verifier: the one of the library, AcceptAllServerKeyVerifier, accepts any key. The known_hosts file is not read: in our runs, a wrong key recorded for the server in the ~/.ssh/known_hosts of the account did not prevent the connection. The library only writes a warning to the job log (WARN level, Server at … presented unverified … key), which the console did not show. No setting of the component changes this.
Conséquence : un serveur qui se ferait passer pour le vrai (nom détourné, réseau non maîtrisé) recevrait les commandes et, avec Mot de passe ou Clavier interactif, le mot de passe. Réservez le composant à des réseaux de confiance, préférez la Clé publique (la clé privée ne quitte pas la machine du job) et un compte distant aux droits limités. Consequence: a server that would pretend to be the real one (hijacked name, network not under control) would receive the commands and, with Password or Keyboard Interactive, the password. Keep the component for trusted networks, prefer the Public key (the private key does not leave the machine of the job) and a remote account with limited rights.
~/.ssh/config est luThe ~/.ssh/config file is read
Le client lit le fichier config du dossier .ssh du compte qui exécute le job. Lors de nos essais, avec une entrée Host sshdemo (HostName et Port), l'Hôte "sshdemo" a mené au serveur de cette entrée, sur son port, même quand le composant donnait un autre Port. Le même job peut donc aller ailleurs selon le compte et la machine qui le lancent.
The client reads the config file of the .ssh folder of the account that runs the job. In our runs, with a Host sshdemo entry (HostName and Port), the Host "sshdemo" led to the server of that entry, on its port, even when the component gave another Port. The same job can thus go elsewhere depending on the account and the machine that start it.
Un Mot de passe ou une Phrase secrète clé écrits entre guillemets sont chiffrés dans le code généré, mais la clé qui les déchiffre est livrée avec le job (routines/system/keys.properties) : quiconque a le job peut les retrouver. Passez-les par des variables de contexte chargées au lancement (tContextLoad), hors du job.
A Password or a Key Passphrase written in quotes is encrypted in the generated code, but the key that decrypts them ships with the job (routines/system/keys.properties): anyone who has the job can recover them. Pass them through context variables loaded at start (tContextLoad), outside the job.
Le composant attend la fin de la commande avant de lire ses sorties. Le client SSH n'accepte que 2 Mio (2 097 152 octets) non lus ; au-delà, le serveur attend le client et la commande ne se termine jamais. Mesuré avec head -c N /dev/zero | tr '\0' a : 2 050 000 octets reçus en entier, 2 150 000 octets job bloqué (arrêté au bout de 40 s). Avec un délai de 5 s, la sortie est coupée sans erreur :
The component waits for the end of the command before reading its outputs. The SSH client only accepts 2 MiB (2,097,152 bytes) unread; beyond that, the server waits for the client and the command never ends. Measured with head -c N /dev/zero | tr '\0' a: 2,050,000 bytes received in full, 2,150,000 bytes job hung (stopped after 40 s). With a 5 s timeout, the output is cut without an error:
String out = (String) globalMap.get("tSSH_1_STDOUT");
System.out.println("EXIT_CODE = " + globalMap.get("tSSH_1_EXIT_CODE"));
System.out.println("STDOUT length = " + (out == null ? null : out.length()));
EXIT_CODE = null STDOUT length = 2097152
(Un peu plus de 3 Mo écrits par la commande.) La limite vaut pour les deux sorties réunies : avec 1 100 000 octets sur chacune, STDERR s'est arrêté à 997 152 octets, 2 097 152 au total (le serveur d'essai a renoncé à écrire au bout de 30 s, EXIT_CODE = 1). Pour une sortie volumineuse, écrivez-la dans un fichier sur le serveur (commande > fichier) et récupérez celui-ci (tSCPGet, tFTPGet en SFTP), ou réduisez-la (| tail -n 100).
(A little more than 3 MB written by the command.) The limit applies to both outputs together: with 1,100,000 bytes on each, STDERR stopped at 997,152 bytes, 2,097,152 in all (the test server gave up writing after 30 s, EXIT_CODE = 1). For a large output, write it to a file on the server (command > file) and fetch that file (tSCPGet, tFTPGet over SFTP), or reduce it (| tail -n 100).
Délai de 2 s, commandes "echo start", "sleep 6", "echo done", sorties vers la variable globale ; le tJava affiche EXIT_CODE et STDOUT.
2 s timeout, commands "echo start", "sleep 6", "echo done", outputs to global variable; the tJava prints EXIT_CODE and STDOUT.
EXIT_CODE = null STDOUT = [start]
Le job ne signale rien, suit On Subjob Ok et se termine avec le code 0 : testez EXIT_CODE pour voir la coupure. Le délai mesure l'inactivité : une commande qui écrit une ligne par seconde pendant 6 s, avec le même délai de 2 s, est allée jusqu'au bout (EXIT_CODE = 0). Sans délai, sleep 6 a été attendu en entier.
The job reports nothing, follows On Subjob Ok and ends with code 0: test EXIT_CODE to see the cut. The timeout measures inactivity: a command that writes one line per second for 6 s, with the same 2 s timeout, went to the end (EXIT_CODE = 0). Without a timeout, sleep 6 was waited for in full.
Deux lignes (Ada, Grace), commande "echo Hello " + row1.name, sortie standard vers la variable globale. Le tJavaRow affiche, pour chaque ligne, tSSH_1_STDOUT :
Two rows (Ada, Grace), command "echo Hello " + row1.name, standard output to global variable. The tJavaRow prints, for each row, tSSH_1_STDOUT:
row Ada: STDOUT = [Hello Ada] row Grace: STDOUT = [Hello AdaHello Grace]
Chaque ligne ouvre sa propre session SSH, mais la sortie s'ajoute à celle des lignes précédentes, sans séparateur ; vers la console l'affiche une seule fois, à la fin, cumulée, et EXIT_CODE est celui de la dernière ligne. Seule la sortie normal repart de zéro à chaque ligne. Pour une commande par ligne avec sa propre sortie, passez par un lien Iterate (tFlowToIterate), comme dans l'exemple de l'itération.
Each row opens its own SSH session, but the output is added to the one of the previous rows, without a separator; to console prints it only once, at the end, accumulated, and EXIT_CODE is the one of the last row. Only the normal output starts again from scratch at each row. For one command per row with its own output, go through an Iterate link (tFlowToIterate), as in the iteration example.
Serveur Windows dont les commandes passent par cmd.exe, commandes "echo one" et "echo two", séparateur par défaut ";" :
Windows server whose commands go through cmd.exe, commands "echo one" and "echo two", default separator ";":
one;echo two EXIT_CODE = 0 STDOUT = [null] STDERR = [null]
cmd.exe ne coupe pas sur ; : une seule commande echo a tourné. Avec " & ", les deux lignes one et two sont sorties.
cmd.exe does not split on ;: a single echo command ran. With " & ", the two lines one and two came out.
outputlineIn Talaxie: the outputline column
Le Studio ajoute la colonne outputline au schéma quand une sortie passe à normal. Talaxie fait de même à partir de la version 9.0.7. Avec Talaxie 9.0.6 ou antérieur, ajoutez-la vous-même (type String) : sans elle, le flux a reçu une ligne vide.
The Studio adds the outputline column to the schema when an output is set to normal. Talaxie does the same from version 9.0.7. With Talaxie 9.0.6 or earlier, add it yourself (String type): without it, the flow received an empty row.
vers la console écrit la sortie d'erreur de la commande sur la sortie standard du job, et seulement à la fin du composant, après toute la sortie standard : les messages ne sont pas mêlés dans l'ordre où la commande les a écrits, et un script qui surveille la sortie d'erreur du job ne les voit pas. to console writes the error output of the command to the standard output of the job, and only at the end of the component, after the whole standard output: the messages are not interleaved in the order in which the command wrote them, and a script that watches the error output of the job does not see them.
Les sorties sont lues en UTF-8, quel que soit le serveur. Commandes printf 'caf\303\251\n' (« café » en UTF-8) puis printf 'caf\351\n' (en ISO-8859-1), sortie vers la variable globale :
The outputs are read as UTF-8, whatever the server. Commands printf 'caf\303\251\n' ("café" in UTF-8) then printf 'caf\351\n' (in ISO-8859-1), output to global variable:
STDOUT = [café caf�]
Faites écrire la commande en UTF-8 (LANG, iconv).
Make the command write UTF-8 (LANG, iconv).
Dans l'exemple de l'itération, la console a aussi affiché, quatre exécutions sur cinq, Exception in thread "Thread-3" java.lang.IllegalStateException: Executor has been shut down et sa pile : un fil de la bibliothèque SSH resté d'une connexion déjà fermée. Le job s'est terminé avec le code 0, sorties complètes.
In the iteration example, the console also printed, four runs out of five, Exception in thread "Thread-3" java.lang.IllegalStateException: Executor has been shut down and its stack: a thread of the SSH library left over from a connection already closed. The job ended with code 0, outputs complete.
Les autres composants de la famille Système, et ceux qui servent avec le tSSH : The other components of the System family, and those used with the tSSH:
tSystem · exécute une commande sur la machine du jobexecutes a command on the machine of the jobtSetEnv · ajoute des variables à l'environnement du jobadds variables to the job environmenttRunJob · lance un autre job du projetruns another job of the projecttJava · lit EXIT_CODE, STDOUT, STDERRreads EXIT_CODE, STDOUT, STDERRtLogRow · affiche la sortie normalprints the normal outputtDie · arrête le job si la commande a échouéstops the job when the command failed