Issue passing variable into shell script

Please see terminal session.
-  calling pwd, unset, or echo alleviate the issue.
- running the script 'plain' also exihibit an issue
- calling 'cat test.sh' causes an issue
I can repeat the issue on OSX 10.5.8
On Ubuntu, two a's always print out with: A=a B=$A ./test.sh
Terminal session:
bash-3.2$ ls -l test.sh
-rwxr-xr-x  1 axure  staff  16 Mar 29 09:27 test.sh
bash-3.2$ cat test.sh
echo $A
echo $B
bash-3.2$ pwd
/Users/axure
bash-3.2$ A=a B=$A ./test.sh
a
a
bash-3.2$ A=a B=$A ./test.sh
a
bash-3.2$ $A
bash-3.2$ $B
bash-3.2$ echo $A
bash-3.2$ echo $B
bash-3.2$ unset
bash-3.2$ A=a B=$A ./test.sh
a
a
bash-3.2$ A=a B=$A ./test.sh
a
bash-3.2$ pwd
/Users/axure
bash-3.2$ A=a B=$A ./test.sh
a
a
bash-3.2$ A=a B=$A ./test.sh
a
bash-3.2$ unset
bash-3.2$ cat test.sh
echo $A
echo $B
bash-3.2$ A=a B=$A ./test.sh
a
bash-3.2$ unset
bash-3.2$ A=a B=$A ./test.sh
a
a
bash-3.2$ A=a B=$A ./test.sh
a
bash-3.2$ unset
bash-3.2$ ./test.sh
bash-3.2$ A=a B=$A ./test.sh
a
bash-3.2$

bash-3.2$ ls -l test.sh
-rwxr-xr-x  1 axure  staff  16 Mar 29 09:27 test.sh
bash-3.2$ cat test.sh
echo $A
echo $B
bash-3.2$ pwd
/Users/axure
bash-3.2$ A=a B=$A ./test.sh
a
a
As I would expect
bash-3.2$ A=a B=$A ./test.sh
a
NOT what I would expect.  I tested this using bash 3.2 and got the same results, HOWEVER, when I tested this with bash 4.0, I got what I expected, namely your first results everytime.
So I think there is a bug in bash 3.2.  You can get the bash sources, and build your own bash if you wish, or use a different method of setting 1 time envionment variables for use in a subprocess.
bash-3.2$ $A
bash-3.2$ $B
bash-3.2$ echo $A
bash-3.2$ echo $B
As expected, as the way you set A & B were as 1 time environment variables that were only seen by the subprocess created when test.sh was run.  A & B were NOT created in the current shell environment, so the current shell environment would not have any values for A & B
bash-3.2$ unset
bash-3.2$ A=a B=$A ./test.sh
a
a
bash-3.2$ A=a B=$A ./test.sh
a
Again, now what I would expect, but as I have already stated, I think there is a bug in bash 3.2 that does not exist in bash 4.0.
Now a bigger question, why are you passing A & B as 1 time envionment variables?  Why not just pass them on the command line?
test.sh a a
where test.sh would be
echo $1
echo $2
Or you could use export to create environment variables A & B
export A=a
export B=$A
test.sh
Now A & B would still exist after test.sh, which I assume you do not want to do.
You could try ceating test.sh as a bash function and see if that changes the behavior
test()
    echo $A
    echo $B
A=a B=$A test
You would have to define test() in your shell initialization scirpt if you needed each time you started a terminal session.
While I have used 1 time environment variables, I more frequently just pass arguments on the command line.

Similar Messages

  • Passing variables from shell script to separate sqlplus script

    Hi, I am having issues passing variables to a separate sqlplus script invoked by the shell script, e.g.
    #!/bin/sh
    DB_NAME=TEST
    PWD1=PA55W0rd
    echo exit | sqlplus / as sysdba @${DB_NAME}.sql ${DB_NAME} $PWD1 >> ${DB_NAME}.sql
    exit 0
    The script picks up the $DB_NAME variable fine, and therefore invokes the required sql script.
    However, when I pass the variable $PWD1 to the sql script I get an error.
    The script creates a database link:
    create or replace procedure new.link
    is
    begin
    execute immediate 'create database link TEST
    connect to TESTSCH identified by '$PWD1'
    using ''TEST''';
    end;
    exec new.link;
    output is:
    ERROR at line 1:
    ORA-00911: invalid character
    ORA-06512: at "NEW.LINK", line 4
    ORA-06512: at line 1
    any help appreciated!
    Edited by: 969765 on Apr 5, 2013 4:24 AM

    969765 wrote:
    that is a pretty unhelpful comment, this is actually my LAST resort I have looked up all the documentation etc.This is what I did...
    I went to the documentation:
    http://www.oracle.com/pls/db112/homepage
    I searched for "sqlplus" which gave me this documentation (under "SQL*plus program syntax")...
    http://docs.oracle.com/cd/E11882_01/server.112/e16604/ch_three.htm#i1169374
    I read the syntax:
    SQLPLUS [ [Options] [Logon|/NOLOG] [Start] ]and the subsequent information:
    >
    where Start has the following syntax:
      @{url|file_name[.ext]} [arg ...]and "Start" was hyperlinked, so I clicked on it, which took me to the section...
    >
    Start
    @} [arg ...]
    Specifies the name of a script and arguments to run. The script can be called from the local file system or from a web server.
    SQL*Plus passes the arguments to the script as if executing the file using the SQL*Plus START command. If no file suffix (file extension) is specified, the suffix defined by the SET SUFFIX command is used. The default suffix is .sql.
    See the START command for more information.
    >
    and here the "START" was hyperlinked, so I clicked on that...
    and hey presto, I ended up here:
    http://docs.oracle.com/cd/E11882_01/server.112/e16604/ch_twelve044.htm#BACJJHDA
    ... where the arguments are described...
    >
    arg ...
    Data items you wish to pass to parameters in the script. If you enter one or more arguments, SQL*Plus substitutes the values into the parameters (&1, &2, and so forth) in the script. The first argument replaces each occurrence of &1, the second replaces each occurrence of &2, and so on.
    >
    ... clearly explaining that SQL*Plus substitutes the substitution variables &1, &2 etc. in the script with the passed in arguments.
    Your script was including a Unix style substitution, not an SQL*Plus script substitution, so that's seems to be the most likely cause of your problem.
    And still you haven't come back to say whether it's worked for you or not... leaving others guessing as to whether you still need help.

  • How to pass variables to shell script?

    I have a shell script which uses the touch command to change the date of a file.  To run the command on the command line the syntax is:
    set-file-date.sh <file> <date>
    I'm trying to run it from an automator workflow, so I'm prompted for the date, then the workflow iterates over the finder items, i.e., files, and changes the date of each files.
    The problem is in the "Run Shell Script" action.  The $@ is substituted with the file names selected in finder, so this will echo the file names:
    for i in "$@"; do
         echo "$i"
    done
    What I want to do is something like this:
    for i in "$@"; do
         set-file-date.sh <DATE VARIABLE> "$i"
    done
    But I can't prompt for the date value, and pass it to the script.  I've tried using the "Get Value of Variable" and the "Ask For Text" actions.  I can either get the file names from finder OR the text input in the "Ask for Text" action, but not both.
    Is what I'm trying to do possible with a shell script?
    -Thanks

    This is standard AppleScript text concatenation...
    set howManyWords to do shell script "wc -w /path/to/file | awk '{print $1}'"
    do shell script "/usr/local/bin/growlnotify -t 'Corpus' -m '" & howManyWords & " words were added to the corpus.'"
    in other words, just use the & to concatenate the parts of your text together.

  • How to SIMPLY use the %DIMENSION_TO_SET% variables into logic scripts

    hello,
    I'm using a prompt of type "COPYMOVE" or "COPYMOVEINPUT". In this type of prompt, there are 2 columns of dimension members list, one for defining the "source zone" and one for defining the "target zone" of logics.
    The left colum of the prompt (for source zone) feeds the variables %DIMENSION_SET% : %ACCOUNT_SET%, %ENTITY_SET%, %CATEGORY_SET%, etc...and these variables can be used in the logic scripts in *XDIM_MEMBERSET instructions for example.
    The right colum of the prompt feeds the variables %DIMENSION_TO_SET% : %ACCOUNT_TO_SET%, %ENTITY_TO_SET%, %CATEGORY_TO_SET%, etc...and I don't know how to SIMPLY use these variables in the logic scripts.
    I've found a tricky way to do that but I meet 2 problems :
    - it is complicated
    - the multi-info instruction (BEGININFO/ENDINFO) seems to be bugged as blank lines are added all the time in the code and sometimes I have to wait for minutes when I try to modifiy the package code through BPC for excel eData/modify package menu.
    So the question is how to SIMPLY get the %DIMENSION_TO_SET% variables into logic scripts and use them ? Thanks, R.
    Here is the tricky package code I use at this time (I build one function for each %DIMENSION_TO_SET% variable and I pass these functions to the logic) :
    PROMPT(COPYMOVE,,,,"ACCDETAIL,ACCOUNT,CATEGORY,DATASRC,ENTITY,TIME,YEARS")
    TASK(Execute formulas,USER,WS-WW\PlauchuR)
    TASK(Execute formulas,APPSET,US)
    TASK(Execute formulas,APP,SV)
    TASK(Execute formulas,SELECTION,D:\BPC\Data\WebFolders\US\SV\PrivatePublications\PlauchuR\TempFiles\FROM_1561_.TMP)
    TASK(Execute formulas,TOSELECTION,D:\BPC\Data\WebFolders\US\SV\PrivatePublications\PlauchuR\TempFiles\TO_1561_.TMP)
    BEGININFO(%FSS%)
    *FUNCTION TARGETACCDETAIL=%ACCDETAIL_TO_SET%
    *FUNCTION TARGETACCOUNT=%ACCOUNT_TO_SET%
    *FUNCTION TARGETCATEGORY=%CATEGORY_TO_SET%
    *FUNCTION TARGETDATASRC=%DATASRC_TO_SET%
    *FUNCTION TARGETENTITY=%ENTITY_TO_SET%
    *FUNCTION TARGETTIME=%TIME_TO_SET%
    *FUNCTION TARGETYEARS=%YEARS_TO_SET%
    ENDINFO
    TASK(Execute formulas,FORMULASCRIPT,%FSS%)
    TASK(Execute formulas,LOGICFILE,D:\BPC\Data\WebFolders\US\SV
    ..\AdminApp\SV\_TEST.Lgf)
    TASK(Execute formulas,RUNMODE,1)
    TASK(Execute formulas,LOGICMODE,1)
    Edited by: ALEXANDRE BEDIER on Jun 16, 2010 3:15 PM

    hello,
    finally I've discovered that there is no need of BEGININFO instruction.
    One can pass several functions to a logic with one FORMULASCRIPT task. The functions definitions have to be separated by instructions. See below :
    PROMPT(COPYMOVEINPUT,%FTARGETS%,,"select source and target zone for category and datasource.","ACCDETAIL,ACCOUNT,CATEGORY,DATASRC,ENTITY,TIME,YEARS")
    TASK(Execute formulas,FORMULASCRIPT,*FUNCTION TACCDETAIL=%ACCDETAIL_TO_SET% *FUNCTION TACCOUNT=%ACCOUNT_TO_SET% *FUNCTION TCATEGORY=%CATEGORY_TO_SET% *FUNCTION TDATASRC=%DATASRC_TO_SET% *FUNCTION TENTITY=%ENTITY_TO_SET% *FUNCTION TTIME=%TIME_TO_SET% *FUNCTION TYEARS=%YEARS_TO_SET%)
    TASK(Execute formulas,USER,%USER%)
    TASK(Execute formulas,APPSET,%APPSET%)
    TASK(Execute formulas,APP,%APP%)
    TASK(Execute formulas,SELECTION,%SELECTIONFILE%)
    TASK(Execute formulas,LOGICFILE,%APPPATH%\..\AdminApp\%APP%\_TEST.LGF)
    TASK(Execute formulas,RUNMODE,1)
    TASK(Execute formulas,LOGICMODE,1)
    Then one will be able to use the functions TACCDETAIL, TCATEGORY, TACCOUNT,... in the logic script.
    Edited by: ALEXANDRE BEDIER on Jun 24, 2010 10:31 AM
    Edited by: ALEXANDRE BEDIER on Jun 24, 2010 10:33 AM

  • Passing parameters from shell script to OWB process flow

    Hi all,
    I am running OWB process flow (using the template script provided by oracle) and i want to pass two date parameters as shown below:
    sqlplus -s $SQL_USER/$SQL_PWD@$ORACLE_SID @$HOME_DIR/src/vmc_oem_exec_script.sql OWB_OWNER VMC_POST_DW_PF_LOC_SIT PROCESS VMC_NM1_PORT_MAIN "," "P_DATE_FROM=$DATE_FROM,P_DATE_TO=$DATE_TO"
    How do i catch those values in process flow and pass those to mappings in Process flow?
    Do i need to create PF variables with same names or any name will do?
    Thanks in advance

    This document is explaining how to pass data between activities in process flow.
    I am passing parameters from a shell script.
    Any ideas,how to pass parameters from shell script and then initialize the process flow variables based on those values and then pass them further to mappings.
    Thanks

  • Deferred Tasks - Passing Variables into Workflow

    Hi everyone
    I am experiencing difficulties with deferred tasks in IDM 8.1. I have managed to create a deferred task on a user, with the task name being ‘Generate Email’. I also passed in an attribute ‘id’, and these can be seen in the user view under waveset.properties.tasks.
      <Activity id='1' name='Add Deferred Task'>
                    <Action id='1' application='com.waveset.session.WorkflowServices'>
                        <Argument name='op' value='addDeferredTask'/>
                        <Argument name='type' value='User'/>
                        <Argument name='name'>
                            <ref>accountId</ref>
                        </Argument>
                        <Argument name='authorized' value='true'/>
                        <Argument name='subject'>
                            <s>Configurator</s>
                        </Argument>
                        <Argument name='task'>
                            <ref>taskToAdd</ref>
                        </Argument>
                        <Argument name='date'>
                            <new class='java.util.Date'/>
                        </Argument>
                        <Argument name='owner'>
                            <ref>WF_CASE_OWNER</ref>
                        </Argument>
                        <Argument name='taskDefinition'>
                            <new class='com.waveset.object.GenericObject'>
                                <map>
                                    <s>id</s>
                                    <ref>accountId</ref>
                                </map>
                            </new>
                        </Argument>
                    </Action>
                </Activity>I have set up a scheduler that correctly scans all the user objects for this workflow name, and the ‘Generate Email’ workflow is periodically run.
    The problem is when it gets to the Generate Email workflow, all the variables that were set when the deferred task was created are gone. Both <ref>id</ref> and <Variable name=’id’ input=’true’/> return null.
    Setting the following in the TaskSchedule object did not help, as the string value $(id) is passed into the workflow instead of the id itself. I cannot debug the TaskSchedule as the Netbeans IDE does not allow me to put in breakpoints on this file.
    <Variables>
        <Object>
          <Attribute name='id' value='$(id)'/>
        </Object>
      </Variables>My question is, how do I pass variables into a workflow via a deferred task?

    Hi,
    Here is an example that I found that may assist.
    <Activity name='setDefTask'>
         <Action application='com.waveset.session.WorkflowServices'>
           <Argument name='op' value='addDeferredTask'/>
           <Argument name='name' value='$(user)'/>
           <Argument name='task' value='$(taskType)'/>
           <Argument name='date' value='$(date)'/>
           <Argument name='description' value='$(taskDescription)'/>
           <Argument name='taskDefinition'>
              <Object>
                  <Attribute name='Arg1' value='value1'/>
                  <Attribute name='Arg2' value='value2'/>
                  <Attribute name='Arg3' value='value3'/>
              </Object>
           </Argument>
         </Action>
         <Transition to='end'/>
    </Activity>Hope it helps

  • How to pass variables into an alert

    Hi,
    I have set up an alert control step in my BPM, and completed all the required config to see the alert is created in my alert inbox. However, I want to pass some parameters into the alert message, such as po number. Does anyone know how to do it? I already defined the variables in the alert category container.
    Your help is appreciated!
    Hart

    Hi Hart
    I don't know if my way is "recommended" but...:)
    1. don't define container variable in alert def
    2. select "dynamic text" in your alert category
    (if you select this you'll be able to pass text from  "alert message" to the alert)
    now it should work
    passing variables into the long text
    of the alert message works for me just great 
    Hope it will for you to:)
    Kind Regards,
    Michal Krawczyk
    https://www.sdn.sap.com/sdn/weblogs.sdn?blog=/pub/u/34500 [original link is broken] [original link is broken] [original link is broken] [original link is broken] [original link is broken] [original link is broken] [original link is broken] [original link is broken]

  • Passing Pl/Sql variables into shell variables.

    I have written a file that ftp information from one pc to another in unix.
    All you have to do is supply a user_name/password and machine name to which ftp program will connect to.
    All connection information like user_id,password, machine name are stored in an oracle table FTP_TBL.
    It has the following fields:
    FTP_TBL
    ================
    USER_ID      NOT NULL VARCHAR2(100);
    USR_PASSWD      NOT NULL VARCHAR2(50);
    TO_MACHINE     NOT NULL VARCHAR2(50);
    I have called a pl/sql script in unix shell.
    This script selects all the connection information from FTP_TBL and populates the pl/sql variables with the
    information.
    Now i want the pl/sql variables like V_TO_MACHINE,V_USR_ID,V_USR_PASSWD to be passed on to unix variables
    To_MACHINE, USR_ID AND USR_PASSWD.
    How can i do this?
    ============================================================================================================
    sqlplus -s <<+++ >> $LOG_FILE
    $USER/$PASSWD
    set serverout on SIZE 1000000
    DECLARE
    V_TO_MACHINE VARCHAR2(100);
    V_USR_ID VARCHAR2(50);
    V_USR_PASSWD VARCHAR2(50);
    BEGIN
         BEGIN
              SELECT TO_MACHINE, USER_ID, USR_PASSWD
              INTO V_TO_MACHINE,V_USR_ID,V_USR_PASSWD
              FROM FTP_TBL;
         EXCEPTION
              when others then
              dbms_output.put_line('ERROR|SQLPLUS|'||ERROR||'|'||sqlcode||'|Failed during selecting configuration information.'||sqlerrm );
         END;
    END;
    +++
    #======================== VARIABLES =====================
    TO_MACHINE=$1
    USR_ID=$2
    USR_PASSWD=$3
    #========================== MAIN ========================
    ftp -vnd $TO_MACHINE << ++ 1>>$STA_LOG_FILE 2>&1
    user $USR_ID $USR_PASSWD
    prompt off
    get $OR_DATA_DIR/ASC.STADATA $HOME_DIR/ASC.STADATA
    bye
    ++
    # testing the exit status of FTP
    egrep "Transfer complete" $STA_LOG_FILE >/dev/null
    if [ $? = 0 ]
    then
    echo >> $STA_LOG_FILE
    echo "FTP Successfully Done" >> $STA_LOG_FILE
    else
    echo >> $STA_LOG_FILE
    echo "FTP UnSuccessfull" >> $STA_LOG_FILE
    exit 1
    fi

    Here an example of how to pass variables to the shell script :
    TEST@db102 SQL> select ename, job, dname from emp,dept
      2  where empno = 7902
      3  and emp.deptno = dept.deptno;
    ENAME      JOB       DNAME
    FORD       ANALYST   RESEARCH
    TEST@db102 SQL> exit
    Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
    With the Partitioning, OLAP and Data Mining options
    [ora102 work db102]$ cat disp_var.sh
    set `sqlplus -s test/test << EOF
    set pages 0
    select ename, job, dname from emp,dept
    where empno = 7902
    and emp.deptno = dept.deptno;
    exit
    EOF`
    echo $1 $2 $3
    [ora102 work db102]$ ./disp_var.sh
    FORD ANALYST RESEARCH
    [ora102 work db102]$                                                  

  • Passing AppleScript string variable to shell script

    I have a script which uses the md5 command line utility to make convenient-sized hashes of some very long strings. Right now I save each string in a temporary text file which is then referenced in the command line:
    set hash to do shell script "md5 -q" & space & quote & POSIX path of tempFile & quote
    This works well, but I wonder if it isn't a little inefficeint, re-writing the temporary file with each new string. md5 has a -s option, which allows the string data to be placed directly in the command line:
    set myText to "Hello World"
    set hash to do shell script "md5 -q -s" & space & quote & myText & quote
    I know that if I do it this way I have to be careful to "escape" all occurrences of quote characters within myText to avoid command line syntax problems. This would not be difficult (in fact, it has already been done for another reason), but I have two questions:
    (1) Are there any other ASCII characters that would have to be similarly escaped? I've tried strings with line breaks in them: Mac-, Unix-, and Windows-style breaks, and they all seem to work, but are there any hidden dangers to doing this?
    (2) myText can get very long: say, 10,000 characters or more, so the command line would be correspondingly long. Is there any kind of limit on the length of command lines in the particular species of UNIX that is running under the Mac hood?
    Many thanks.
    Dual 1.2 GHz   Mac OS X (10.4.8)  
    Dual 1.2 GHz    

    >(1) Are there any other ASCII characters that would have to be similarly escaped? I've tried strings with line breaks in them: Mac-, Unix-, and Windows-style breaks, and they all seem to work, but are there any hidden dangers to doing this?
    There are many characters that can fall foul of a do shell script command, which is why Apple gave a convenient way of handling it via quoted form of:
    <pre class=command>set myText to "Hello World"
    set hash to do shell script "md5 -q -s "  & quoted form of myText</pre>
    This will take care of escaping various characters that might confound the shell.
    >(2) myText can get very long: say, 10,000 characters or more, so the command line would be correspondingly long. Is there any kind of limit on the length of command lines in the particular species of UNIX that is running under the Mac hood?
    It varies by OS version, but 262,000 bytes is the technical limit.

  • Trouble passing variable into package

    I am having an issue reading a variable in a script task that I'm passing in from a windows service. I should be able to pass the param in from .NET and load it into one of my package vars right? The windows service is a file watcher service.
    Windows Service code
                        Package pkg;
                        Application app;
                        DTSExecResult pkgResults;
                        Variables vars;
                        app = new Application();
                        pkg = app.LoadPackage(pkgLocation, null);d because I log it to a log file.
                        vars = pkg.Variables;
                        vars["User::FileName"].Value = sFileName.ToString();
                        pkgResults = pkg.Execute(null, vars, null, null, null);
    The sFileName variable in the service is populated because I write it to a log file.
    In the package I list the FileName variable as read/write. Have checked the spelling.
    package code snippet:
          public void Main()
          //get file and path info
          string sFileName = Dts.Variables["User::FileName"].Value.ToString();
    the package fires but the variable is empty and I log an exception to the sysssislog:
    System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentOutOfRangeException: Index and length must refer to a location within the string.  Parameter name: length    
    at System.String.InternalSubStringWithChecks(Int32 startIndex, Int32 length, Boolean fAlwaysCopy)     at ST_5a4733488a6149abb109d633296e2c38.csproj.ScriptMain.Main()     --- End of inner exception stack trace ---    
    at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)     at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)    
    at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)     at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object
    target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)     at Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTATaskScriptingEngine.ExecuteScript()
    I cannot find what the issue is. In the package I log to a text file the value of FileName variable and as expected it is empty.
    I appreciate your help wit

    The scripting task which is designed to retrieve the file name from the package var User::FileName is listed in the scripting tasks read/write variables and it is a package level variable. Is that what you mean by "expects" Arthur? If so then yes. But is
    there a property setting on the script task that has to be set?
    I could use the config file but the file name changes daily with a date stamp suffix. I could also just sweep the directory when the file watcher executes the package but that all seems so sloppy considering that I should be able to pass the filename in
    as a variable.
    Thanks for talking through this with me. I appreciate it.

  • My first foray into shell scripting: tomcatctl

    I've written a tomcatctl script (a script for controlling Tomcat, loosely based on all those other somethingctl scripts for controlling things, like apachectl).
    It does start, stop, restart, status and version. It seems to work okay on my MacBook Pro, however, on my old, creaky G4 server, there seems to be a problem with restart. Apparently it tries to restart Tomcat before it has completely quit, leaving Tomcat in a weird, undead, zombielike state where it appears to be running, writing zero k log files, and not responding to requests, and it stays this way until I reboot the machine.
    If anyone out there is brave enough to try it out, I'd like to get some feedback, especially from people with different configurations and people with a little shell scripting experience.
    I'm sure I've made every conceivable noob scripting mistake, and I can't assume any responsibility for any damage it might cause, although I didn't manage to destroy anything while I was writing it, and it even worked fairly well on a 7 1/2 year old machine, except for the issue noted above.
    Download: http://idisk.mac.com/dlivesay-Public/tomcatctl.zip
    Unzip and put it in your command path. Please read it first and understand before you run. There are some lines at the top that have to be commented out or removed before it will run. You will probably also need to configure at least the "$CATALINA_HOME" environment variable before it will work.
    Please, please, pleeeease don't use this on a production server until it has been throughly tested on a similarly-configured machine!

    Joshua S wrote:
    What if you put in sleep between the stop and start (for restarting) so tomcat has time to shut down gracefully?
    That is not a very elegant solution. There is no way to know how long to wait. There should be some mechanism to determine when tomcat has successully shut down.
    Or, it could be a problem with the way you are starting tomcat. Follow the instructions in this thread to track it down.

  • Problem while passing parameter to shell script which sends email-Ora Apps

    Hi,
    I have a pl/sql package which will call a shell script program.The shell script program is written in order to send the invoice hold details of AP as a mail.The parameters to this program are passed in the pl/sql package.
    The shell script program has
    5 parameters namely
    to - email
    from - email
    hold id - which is a number
    hold name - varchar2( free text)
    hold reason - varchar2( free text)
    the shell script looks as below.
    FROM_EMAIL=`echo $1|cut -f9 -d " "|sed 's/\"//g'`
    echo "From email id is $FROM_EMAIL" -- From email
    TO_EMAIL=`echo $1|cut -f10 -d " "|sed 's/\"//g'`
    echo "To Email id is $TO_EMAIL" -- to email
    PARAM0=`echo $1 | awk '{print $11}'|sed -e "s/\"//g"`
    echo "Param0: $PARAM0" -- hold id
    PARAM1=`echo "$1" | cut -d" " -f12-| sed -e "s/\" \"/\"^\"/g" | awk -F'^' '{print $1}'|sed -e "s/\"//g"`
    echo "Param1: $PARAM1" -- hold name
    PARAM2=`echo "$1" | cut -d" " -f13-| sed -e "s/\" \"/\"^\"/g" | awk -F'^' '{print $1}'|sed -e "s/\"//g"`
    echo "Param2: $PARAM2" -- hold reason
    the values that am passinf to this program are if suppose
    from email ---- [email protected]
    to email [email protected]
    12345 ------ hold id
    test hold name ------ hold name
    test hold reason ------- hold reason
    The output for the above parameters is as follows
    from email ---- [email protected]
    to email [email protected]
    12345 ------ hold id
    test hold name ------ hold name
    hold name --------hold reason (a part of hold name parameter is displayed as hold reason.The reason being in param2 we used cut which is cutting from 13.
    the problem here is since param1 being free text we cannot predict at what position the parameter ends.i mean there might be a single word or more than 2 words in that parameter seperated by space. the question here is ... is there anyway that we can specify dynamically from which location the param2 should fetch the value.
    can we use some delimiter to identify the end of param1 and start of param2.If so... how can it be written in this scenario.
    Thanks in Advance.

    As I see, all parameters are merged into 1 at shell script.
    Please do as follow:
    1- Modify your shell script as followed:
    echo "From email id is $1" -- From email
    echo "To Email id is $2" -- to email
    echo "Param0: $3" -- hold id
    echo "Param1: $4" -- hold name
    echo "Param2: $5" -- hold reason
    2- rename your shell script file with .prog extension : CUSTOM_NAME.prog
    3- perform the following command at custom file location:
    ln -s $FND_TOP/bin/fndcpesr CUSTOM_NAME
    This approach will seperate your parameters and then it will be more easier to manipulate them.
    Regards

  • Passing password from shell script to Java

    Hi there,
    I have a shell script which has user id and password stored in variables. I call a java program from this shell script. I tried accessing this environment variable from java using system.getproperty and java is not getting the values. I have used export USERID PASSWORD
    and java classname to call it.
    I do not want to pass it as arguments because of security reasons. can anybody help me please.
    Thanks a bunch.

    Hi there,
    I have a shell script which has user id and
    password stored in variables. I call a javaprogram
    from this shell script. I tried accessing this
    environment variable from java using
    system.getproperty and java is not getting the
    values. I have used export USERID PASSWORD
    nd java classname to call it.
    Presumably you are using one of the newer java
    versions.
    Questions
    1. What statements are you using to set, export and
    run java?
    2. What shell are you using?
    3. How are you accessing the vars in java?
    I do not want to pass it as arguments because of
    security reasons. can anybody help me please.
    That is nonsensical. Putting it in env vars exposes
    it more than passing it as args.Thanks for replying jschell.
    1. I am using newer version java 1.5
    2. shell scripts gets it's variables from oracle reports through webservices.
    3. to run java i use java javaclassname3. I used EXPORT variablename and in java called system.getproperty(variablename)But system.getproperty is getting a null.
    And the decision about not passing it as args was made by our client. They think it's not safe to pass password.
    are they wrong??
    Please help me.

  • Pass variable into xMII applet???

    Is it possible to pass a javascript variable into the xMII applet?

    I guess what I asking is could I place a variable that I created in the head of the html file and then call for it in the applet.
    The variable is called in the Applet name below.
    For Example:
    <html>
    <head>
    <script>
            var TEST = alert("")
    </script>
    </head>
    <body>
    <tr>
    <td>
                                       <applet name="TEST" codebase="/Illuminator/Classes" code="iGrid" archive="illum8.zip" width="775" height="350" mayscript>
                                       <param name="DisplayTemplate" value="/Production/gridQA_Moistures">
                                       <param name="QueryTemplate" value="/Production/qryQA_Moistures">
                                       <param name="UpdateEvent" value="Grid_Updated">
                                       <param name="Param.1" value="%">
                                       <param name="Param.2" value="%">
                                       <param name="Param.3" value="%">
                                       <param name="Param.4" value="%">
                                       </applet>
    </td>
    </tr>
    </body>
    </html>

  • Passing variable into pdf document

    I have created a pdf document that I want to share with my marketing team.  However, in the document I want the url to be dynamic and show that individual's url.   For example, if my domain is www.xyz123abc.com   In the pdf, I want to setup the url in the document as www.xyz123abc.com/REPSITE.  Then when the pdf is opened from each individual's site, we will pass the REPSITE variable into the pdf document.   If my marketing page is www.xyz123abc.com/jim.   When someone visits my website and opens the pdf, they will see www.xyz123abc.com/jim.  When my partner Bob's site is visited, the pdf will display www.xyz123abc.com/bob. 
    So how can I dynamically pass variables from a website into the pdf?  

    Don't know if there is a better way, but you could use the 'identity Object'. Just make sure that the Identity is set in the application preferences for each employee
    var userName = identity.name
    Edit: Sorry, after rereading your post, I don't think this is what you are asking for. Perhaps the 'HostContainer Object' wll allow you to do what you want?

Maybe you are looking for

  • Microsoft.Office.Interop.Word error on Windows Server 2008 R2

    Hi, I have Microsoft Office 2003 installed on Windows Server 2008 R2. I get a "There is insufficient memory. Save the document now." error while adding a document to the Microsoft.Office.Interop.Word.Document class as in the code below. I can see the

  • Removing overset text in empty table rows (InDesign CS5.5)

    I have some overset text in a table that appears to be empty rows.  I've opened story editor so I can remove the text, but I can't select the area that's overset (the red lines).  How does one remove this overset stuff if you can't select it.

  • Boxes within Anchored Boxes

    I hope I explain this right. I don't have much experience with anchored objects in InDesign and I got catalog files for my job and I can't figure this out. On the page there are a bunch of boxes anchored to the columns(first image), within that ancho

  • Programatiicaly determine if a subsequence exists

    How do I determine if a named sequence exists in a sequence file (not the current sequence file) and if present, execute it? The file in which the sequence resides may or may not be loaded. I would like to do this within a TestStand sequence (presuma

  • Recover a deleted playlist in latest iTunes version

    Hi I accidentally deleted my burned MP3 playlist from iTunes and how do I recover it to burn some other MP3 CDs to give as a gift to my friends? I do not want to add songs again because there are very many songs in the playlist. Please help. Thank yo