TrySystem()

Versucht die Ausführung eines Shell-Befehls.

TrySystem(Befehl)

Führt wie System() einen Befehl auf der Shell sh aus, liefert aber stets 0 zurück, wohingegen System() bei einem Fehler -1 zurückgibt.

Setzt die Channelvariable SYSTEMSTATUS auf SUCCESS (erfolgreich ausgeführt), FAILURE (konnte nicht ausgeführt werden) oder APPERROR (Befehl ausgeführt aber mit Exit-Code ungleich 0).

exten => 123,1,TrySystem(echo 'Hallo Welt' > /tmp/hallo.txt)
[Anmerkung]Anmerkung

Interner Hilfetext zu dieser Applikation in Asterisk 1.4: 

  -= Info about application 'TrySystem' =- 

[Synopsis]
Try executing a system command

[Description]
  TrySystem(command): Executes a command  by  using  system().
on any situation.
Result of execution is returned in the SYSTEMSTATUS channel variable:
   FAILURE  Could not execute the specified command
   SUCCESS  Specified command successfully executed
   APPERROR Specified command successfully executed, but returned error code

Old behaviour:
If  the command itself executes but is in error, and if
there exists a priority n + 101, where 'n' is the priority of the current
instance, then  the  channel  will  be  setup  to continue at that
priority level.  Otherwise, System will terminate.

Differenz zum internen Hilfetext in Asterisk 1.2: 

- keine - 

Siehe auch. System()


Version 1.2, November 2002

Neue Version verfügbar

Sie betrachten gerade die alte Version des Buches (Version 1.0). Wir empfehlen Ihnen für Asterisk 1.4 und 1.6 die neue Version des Buches.

Asterisk-Tag 2008

Lernen Sie Mark Spencer (den Erfinder von Asterisk) kennen! Viele Vorträge, Case-Studies und Workshops rund um das Thema VoIP. Asterisk-Tag.org

Das gedruckte Buch