#257 On linux x86_64, wrapper 3.5.7 shell script does not work

closed
5
2011-10-04
2011-04-14
Thuy
No

We've been using wrapper for quite some time. We just upgraded to wrapper 3.5.7 and noticed that executing the wrapper shell script (sh.script.in file that's been modified and renamed to fit our environment) with start, stop, or status does nothing. Even the wrapper.log does not show any messages of trying to start. We replaced the wrapper shell script with a previous version shell script (3.5.4) and the start/stop/status commands work as expected. We've verified the file ownerships and permissions are exactly the same and the properties specific to the environment are the same so have deduced that something in the new script is causing the problem.

Discussion

  • Thuy

    Thuy - 2011-04-14

    the 3.5.7 wrapper shell script that isn't working

     
  • Christian Mueller

    • assigned_to: nobody --> naytzyrhc
     
  • Christian Mueller

    Thuy,

    the script is working on my platform so, I'm not quite sure what could have broken the script for you right now.

    Could you please post the output of the following commands here:
    uname -a
    locale
    env

    Also if possible, could you add to the 3.5.7 script the following line at the top (line 2 or so):
    set -x

    and rerun the script and post its output.

    This should give me some more information to exactly tell what was changed.

    Best Regards,
    Christian

     
  • Christian Mueller

    Thuy,

    I was just noticing the script you attached to this thread.

    WRAPPER_CMD="/usr/bin/wrapper"
    RUN_AS_USER=crluser
    PIDDIR="/etc/crlapp/run"

    can you also verify you are having enough access rights to write to the location specified in PIDDIR?
    also what are you seeing if you run "./crlapp console" ?

    -Christian

     
  • Thuy

    Thuy - 2011-04-15

    Just discovered that the shell script from wrapper version 3.5.4 was modified below the "Do not modify anything beyond this point" line by one of our coworkers in order for the wrapper script to work. These are the changes:

    Added new property to modified file:
    # Add the shell to be used when invoking the process.
    # Note that this is used whenever a login shell is denied to the process owner.
    SU_ARGS="-s /bin/bash"

    Line 195 Original:
    DIST_OS=`uname -s | tr [A-Z] [a-z] | tr -d ' '`

    Modified:
    DIST_OS=`uname -s | tr 'A-Z' 'a-z' | tr -d ' '`

    Line 232 Original:
    DIST_ARCH=`uname -p 2>/dev/null | tr [A-Z] [a-z] | tr -d ' '`

    Modified:
    DIST_ARCH=`uname -p 2>/dev/null | tr 'A-Z' 'a-z' | tr -d ' '`

    Line 239 Original:
    DIST_ARCH=`uname -m 2>/dev/null | tr [A-Z] [a-z] | tr -d ' '`

    Modified:
    DIST_ARCH=`uname -m 2>/dev/null | tr 'A-Z' 'a-z' | tr -d ' '`

    Line 504 Original:
    /sbin/runuser - $RUN_AS_USER -c "\"$REALPATH\" $2"

    Modified:
    /sbin/runuser - $RUN_AS_USER -c "\"$REALPATH\" $2" ${SU_ARGS}

    Line 506 Original:
    su - $RUN_AS_USER -c "\"$REALPATH\" $2"

    Modified:
    su - $RUN_AS_USER -c "\"$REALPATH\" $2" ${SU_ARGS}

    Line 907 Original:
    APP_NAME_LOWER=`echo "$APP_NAME" | tr [A-Z] [a-z]`

    Modified:
    APP_NAME_LOWER=`echo "$APP_NAME" | tr 'A-Z' 'a-z'`

    Line 1085 Original:
    APP_NAME_LOWER=`echo "$APP_NAME" | tr [A-Z] [a-z]`

    Modified:
    APP_NAME_LOWER=`echo "$APP_NAME" | tr 'A-Z' 'a-z'`

     
  • Thuy

    Thuy - 2011-04-15

    Christian - Will run the commands and make the changes you've requested tomorrow.

    Thanks!

     
  • Thuy

    Thuy - 2011-04-15

    Ok, we discovered the problem. It's specific to our environment since the RUN_AS_USER (crluser) is not provided a shell for security reasons. Thus, the central problem with the wrapper script as installed is that it does not specify a shell for the application launch command. To work around this issue, any process launched using this must specify the shell since it won't be provided by the system.

    In short this means that any line resembling this:

    /sbin/runuser - $RUN_AS_USER -c "\"$REALPATH\" $2"

    Must be modified to be this:

    /sbin/runuser - $RUN_AS_USER -s /bin/bash -c "\"$REALPATH\" $2"

    Since making that change on line 562 & 564 of the original script file for version 3.5.7, it now works.

     
  • Christian Mueller

    • status: open --> closed
     

Log in to post a comment.