Ad Widget

Collapse

Escaping a command for system.run

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • finalbeta
    Junior Member
    • Sep 2015
    • 9

    #1

    Escaping a command for system.run

    Hi,

    I want to follow the postfix queue.
    The command "postqueue -p | tail -n 1 | awk "{print match($5, /[^ ]/) ? $5 : 0}" does what I want.
    If the queue is empty, it returns 0, else it returns the number of mails.

    I'm unable to add it inside the system.run due to "incorrect syntax".

    How to preperly add the command? How to escape it?
  • niveastn
    Member
    • Oct 2021
    • 82

    #2
    Hi there!

    All double quotes and backslashes in the command are escaped with backslashes and the command is enclosed in double quotes.

    But may I suggest you a better solution? why not use UserParameter? is going to give you a lot more flexibility

    Comment

    • finalbeta
      Junior Member
      • Sep 2015
      • 9

      #3
      Thanks for your reply niveastn. That helped!
      (I have full control of the server, agent configs are somewhere else, in my case this is easier)

      Comment

      Working...