in reply to system call

You didn't tell us, what goes wrong.

Your code is syntactical correct. But:

They may contain special shell characters like &, ;, `, ', ", |, *, ?, ~, <, >, ^, (, ), [, ], {, }, $ and \.

Your CGI-script mostly does not run under the same UID as your command line script, so you should think of:

To examine your situation, you should look at possible errors and use backticks with redirecting STDERR to STDOUT:

# see what happens print `$your command 2>&1 > output`;

-- Frank