Folks,
I'm fairly new to Perl and UNIX, but have been placed with the UNIX team at work for a month.
My first task is to create a script which mounts NFS shares and raises an alert upon failure (we have a system called 'Remedy' which displays incident alerts to a 24-7 team).
To generate a Remedy alert, we have a UNIX binary, which returns zero on success and another number on failure. It also outputs to STDOUT or STDERR on failure (at least that's now I understand it, but am unsure how to test this).
What I really need is to capture the command's return code, but also keep a record of the STDOUT/STDERR (for logging purposes).
system() gives me the return code, but no STDOUT/STDERR whilst backticks (` `) do the opposite.
The command I'm running is:
[red]
system( "/bin/su", "-c", "/home/remedy/Remedy_gentkt -s \"$fault_title\" -L \"$description\"", "non_root_user" );
[/red]
I'm sure there must be a way. Any suggestions would be greatfully received ;-)
I'm fairly new to Perl and UNIX, but have been placed with the UNIX team at work for a month.
My first task is to create a script which mounts NFS shares and raises an alert upon failure (we have a system called 'Remedy' which displays incident alerts to a 24-7 team).
To generate a Remedy alert, we have a UNIX binary, which returns zero on success and another number on failure. It also outputs to STDOUT or STDERR on failure (at least that's now I understand it, but am unsure how to test this).
What I really need is to capture the command's return code, but also keep a record of the STDOUT/STDERR (for logging purposes).
system() gives me the return code, but no STDOUT/STDERR whilst backticks (` `) do the opposite.
The command I'm running is:
[red]
system( "/bin/su", "-c", "/home/remedy/Remedy_gentkt -s \"$fault_title\" -L \"$description\"", "non_root_user" );
[/red]
I'm sure there must be a way. Any suggestions would be greatfully received ;-)