Neil Beardsley

Q: fcsvr_client getmd works in Terminal, not from Response

I've written a script that grabs the contents of a metadata lookup named PAENUM_CUSTCLIENTS and does some stuff with it. I get the contents just fine if I run the script from the command line, but I get absolutely nothing when running with a Subscription in FCS.

The full command I'm executing:
/Library/Application\ Support/Final\ Cut\ Server/Final\ Cut\ Server.bundle/Contents/MacOS/fcsvrclivrclient getmd /enum/PAENUM_CUSTCLIENTS

Run from the command line, my "clients" variable is 746 bytes long.

Run from within FCS, my "clients" variable is 0 bytes long.

I've tried piping the output of the command into a file instead of reading directly, but the file is empty. I'm thinking it's a shell problem, but I'm not sure. I am using Perl.

Later in the script, I use "fcsvrclivrclient setmd", which works fine. Anything that outputs seems to not be readable, i.e., list_groups is also empty.

Any help is much appreciated!

Neil

Posted on Jan 14, 2011 4:12 PM

Close

Q: fcsvr_client getmd works in Terminal, not from Response

  • All replies
  • Helpful answers

  • by Neil Beardsley,

    Neil Beardsley Neil Beardsley Jan 15, 2011 8:38 AM in response to Neil Beardsley
    Level 1 (4 points)
    Mac OS X
    Jan 15, 2011 8:38 AM in response to Neil Beardsley
    So I added a log of the current shell, and I get empty when FCS runs an external script. Is it normal behavior for FCS to launch scripts without a shell?
  • by nylonoxygen77,

    nylonoxygen77 nylonoxygen77 Jan 17, 2011 6:39 PM in response to Neil Beardsley
    Level 1 (30 points)
    Jan 17, 2011 6:39 PM in response to Neil Beardsley
    Hmm. Well, it could be that FCSvr is not passing the argument (/enum/PAENUM_CUSTCLIENTS) to the script. Try running the script without an argument from the command line and see if you get the same results.

    In the run external scripts or commands response, your script (the /Library/Final\ Cut\ Server/...etc) part should be in the "Command Path" field and the argument (/enum/PAENUM_CUSTCLIENTS) should be in the "Parameters" field.

    Be careful! Don't get too brave with your production server...
  • by John F. Whitehead,

    John F. Whitehead John F. Whitehead Jan 17, 2011 8:15 PM in response to Neil Beardsley
    Level 2 (380 points)
    Jan 17, 2011 8:15 PM in response to Neil Beardsley
    Is it normal behavior for FCS to launch scripts without a shell?


    Yes. Scripts are launched with an exec. You need to explicitly call the shell if that's what you want to have happen.
  • by jamesheliker,

    jamesheliker jamesheliker Feb 15, 2011 1:42 PM in response to John F. Whitehead
    Level 1 (0 points)
    Feb 15, 2011 1:42 PM in response to John F. Whitehead
    Hi -

    What kind of script are you working with?

    I can confirm that all fcsvr_client commands do indeed return output as expected to STDOUT when called from perl using backticks.

    I hope that helps!

    - James Heliker
  • by Neil Beardsley,

    Neil Beardsley Neil Beardsley Mar 3, 2011 2:52 PM in response to jamesheliker
    Level 1 (4 points)
    Mac OS X
    Mar 3, 2011 2:52 PM in response to jamesheliker
    I have a pretty thorough Perl script to do this work. Here's the basic flow:

    • From FCS, I send the Asset ID, Device, and Location (file path).
    • Based on the path, I extract some keywords
    • One of these keywords is CLIENT, which is actually an ENUM in FCS
    • Because it's an ENUM, I verify that the CLIENT keyword based on the path is in the ENUM before setting it
    • I set all the keywords for the asset at the end


    So what breaks down is getting the ENUM content when executing from FCS even though that works fine running directly from the Terminal.

    Here's the lines in the script where I setup the command to get the CLIENTS ENUM:

    my $fcsvrClientCommand = "/Library/Application\ Support/Final\ Cut\ Server/Final\ Cut\ Server.bundle/Contents/MacOS/fcsvr_client";

    my $clientFetchCommand = "\"$fcsvrClientCommand\" getmd /enum/PAENUM_CUSTCLIENTS | /usr/bin/grep ENUM_ENTRIES";

    my $clients = `$clientFetchCommand`;


    Any other insights would be awesome! Sorry for not posting for so long, but we actually moved our offices over the last two months and that swallowed all my time. Let me know if there is something else I can post to help.