Put 'do shell script' multi-line with comments

I would like to integrate a Bash in Applescript script, as it is on several lines with comments.

The only documentation useful, that I can find is tn2065, but as far as I can see, it does not say how.

What is the correct syntax?

Maybe I'm missing something, but you can just write your script bash as a text object and passing to the shell script:

game of longBashCommand to "# some relevant comments.

CD /somedir

/ bin/something - foobar

# one other comment here

/ bin/Gisèle

' # one other comment.

the shell script longBashCommand

The trickiest part is perhaps the need to escape some characters such as quotation marks in the command shell.

Tags: Mac OS & System Software

Similar Questions

  • How do I Center a text entry field can be single or multi-line?

    I have created a form in Adobe Acrobat Pro XI and have almost everything I like.  One of my latest problems trying to get a text in a field of centered text.  The entrance is sometimes a single line and multi-line sometimes.  If I put in place for multi-line entries are centered, then the single line looks like offshore... and vice versa.  Is it possible to have the centered text automatically in the text field single or multi-line?

    Unfortunately, there is no way to set up a field so that the text is guaranteed to be centered vertically in both cases. If you set up so that the rich text formatting is enabled, it is possible for a user centered vertically, but this isn't something you can preconfigure so that it remains in effect when the field is cleaned. For a user to do, with the emphasis placed on the ground that they would have to display the toolbar properties (Ctrl + E), click on the "more..." "> paragraph > alignment > intermediate text [button]

  • Re: Unix shell script to notify if an array has reached a number of lines

    Looking to write a script to send an alert notification when an Oracle database table object reaches a certain value of line number. If anyone has the logic "If this while" for a script shell unix would be great.

    With the logic of control and check on the table when it reaches the total line number can be added to the script and on-demand via cron.

    Thank you.

    Thus, you must periodically (how often?) a COUNT (*) on the target table?  Is this acceptable overhead?

    /Korn Bourne shell scripts can compare numbers and check if one is greater than another.  See "-gt" UNIX - Shell basic operators

    Hemant K Collette

  • Need an example of loop with sql statement in shell script values

    Hello

    I have to present a simultaneous program to each line of the table through script shell (only).

    The table has all the parameters required to pass to the concurrent program.

    I have trouble in a loop with the lines of sql statement results.

    Could someone give me an example of a shell script with a loop with the sql statement values.

    appreciate your time and your help.

    Thank you

    Ganesh

    Hello

    Here is a guide using 3 parameters:

    {

    sqlplus-s $OA_USR / $OA_PWD<>

    SET THE OFF POSITION;

    SET FEEDBACK OFF;

    SET LINESIZE 300;

    SELECT param1, param2, param3

    Of your_param_table;

    ENDOFSQL

    } | while reading line

    do

    If ['$line'] # line non-NULL

    then

    set $line

    param1 = "$1."

    param2 = "$2."

    param3 = "$3."

    # Pass parameters to a script, sql more

    sqlplus-s $apps_usr / $apps_pwd @SUBMIT_CONC_PROG.sql $param1 $param2 $param3

    FI

    fact

    }

    In your SQL * more script you run 3 parameters into variables:

    declare

    VARCHAR2 (10) param1: = ' & &1';

    VARCHAR2 (10) param2: = ' & &2';

    param3 varchar2 (10): = ' & &3';

    .....

  • sqlplus from a shell script with the variable in unix

    I'm having some trouble calling sqlplus from a shell script... I am basically asking for a path/name of file which I attribute to one to a variable called $code. Then use cp to move the file ($code) to a new directory. I think that there is something wrong with my sqlplus below. echo $code does not work yet. I thought that $code was variable, which I could see, but rather it seems that the script is trying to rerun the SQL command each time.

    Any help would be greatly appreciated... condensed version of the code is below. Thank you!

    file in $FILES
    do
    Code =""
    code ='sqlplus-s $USER_PWD < < EOF
    Set the off position;
    set pagesize 0;
    Select r.outfile_name OUTFILE
    some paintings
    where file_name = $file;
    EXPRESSIONS OF FOLKLORE"
    echo $code
    CP $code $newdir

    Hello

    I hope code below will help but set feedback off so that he won't be any info if no line selected

    echo ${CODE}
    if [ -z "${CODE}" ]
    then
    echo "No rows returned"
    else
    echo "Returned"
    fi
    

    Concerning
    CA
    uninstall security tool
    essential elements of the Security window
    Windows startup configuration
    the Award bios update

  • I downloaded Lightroom 6 today (single license), but when I try to put in place, it is blocked with the comment "product installed only on a 64-bit system.

    I downloaded Lightroom 6 today (single license), but when I try to put in place, it is blocked with the comment "product installed only on a 64-bit system.

    Hi Fred,.

    6 Lightroom requires Mac OS X 10.8 superior, or a 64-bit version of Windows 7, 8 or 8.1. See the system requirements for Photoshop Lightroom for Mac OS and Windows

    It could be useful!

    Kind regards

    Shelly

  • Need help with some cluster power shell scripts

    Guys,

    I need help with 2 scripts.

    Text 1.

    I need a power shell script that will get all the virtual machine in a specific cluster.  Virtual machine names as well as the number of processors, output allocated RAM and size of CSV file.

    Text 2.

    I need a script that will get all data warehouses in a specific cluster and store name data as well as the amounf of free space for a CSV output.

    Thanks in advance guys.

    Greetings, @peter79 -.

    For the first part:

    Get-Cluster myClusterName | Get-VM | Select-Object Name, MemoryMB, NumCpu | Export-Csv -NoTypeInformation c:\temp\myVMInfo.csv
    

    And for the second, how about:

    Get-Cluster myClusterName | Get-VMHost | Get-Random | Get-Datastore | Select-Object name, FreeSpaceMB, CapacityMB | Export-Csv -NoTypeInformation c:\temp\myDaterstoreInfo.csv
    

    The first would be quite a bit faster by using Get - view instead of Get - VM.  It would be like:

    ## get an array of VM View objects with just the desired/needed properties
    $arrVMViews = Get-View -ViewType VirtualMachine -SearchRoot (Get-Cluster myClusterName).MoRef -Property Config.Hardware,Name
    ## make the two filters for displaying the desired info
    $hshCPUCountFilter = @{n="NumCPUs"; e={$_.Config.Hardware.NumCPU}}
    $hshMemAmtFilter = @{n="MemoryMB"; e={$_.Config.Hardware.MemoryMB}}
    ## display the info, and export to CSV
    $arrVMViews | Select-Object name, $hshCPUCountFilter, $hshMemAmtFilter | Export-Csv -NoTypeInformation c:\temp\myVMInfo.csv
    

    Enjoy.

  • How to build a JTree with nodes multi-line Windows L and am FJt

    Although I already found 2 ways to build nodes multi-line JTree but both methods work very well in Java by default appearance and when I change my windows look and feel then it fails. I can't understand what is the problem. The two ways by which I build multi line nodes are:

    First: Using html in nodes
    as the DOSB linea < br > < html > < / html >

    Secondly: By implementing TreeRenderer and change it accordingly, such a class is given below
    class ModifiedTreeCellRenderer extends JPanel implements TreeCellRenderer {
        protected JLabel icon;
        protected TreeTextArea text;
        
        public ModifiedTreeCellRenderer() {
            setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
            icon = new JLabel() {
                @Override
                public void setBackground(Color color) {
                    if (color instanceof ColorUIResource)
                    color = null;
                    super.setBackground(color);
                }
            };
            add(icon);
            add(Box.createHorizontalStrut(4));
            add(text = new TreeTextArea());
        }
        
        @Override
        public Component getTreeCellRendererComponent(JTree tree, Object value, boolean isSelected, boolean expanded, boolean leaf, int row, boolean hasFocus) {
            String stringValue = tree.convertValueToText(value, isSelected, expanded, leaf, row, hasFocus);
            setEnabled(tree.isEnabled());
            text.setText(stringValue);
            text.setSelect(isSelected);
            text.setFocus(hasFocus);
            if (leaf) {
                icon.setIcon(UIManager.getIcon("Tree.leafIcon"));
            } else if (expanded) {
                icon.setIcon(UIManager.getIcon("Tree.openIcon"));
            } else {
                icon.setIcon(UIManager.getIcon("Tree.closedIcon"));
            }
            return this;
        }
    
        @Override
        public Dimension getPreferredSize() {
            Dimension iconD = icon.getPreferredSize();
            Dimension textD = text.getPreferredSize();
            int height = iconD.height < textD.height ? textD.height : iconD.height;
            return new Dimension(iconD.width + textD.width, height);
        }
    
        @Override
        public void setBackground(Color color) {
            if (color instanceof ColorUIResource)
                color = null;
            super.setBackground(color);
        }
    
        class TreeTextArea extends JTextArea {
            Dimension preferredSize;
            
            TreeTextArea() {
                setLineWrap(true);
                setWrapStyleWord(true);
                setOpaque(true);
            }
    
            @Override
            public void setBackground(Color color) {
                if (color instanceof ColorUIResource)
                color = null;
                super.setBackground(color);
            }
    
            @Override
            public void setPreferredSize(Dimension d) {
                if (d != null) {
                preferredSize = d;
                }
            }
    
            @Override
            public Dimension getPreferredSize() {
                return preferredSize;
            }
    
            @Override
            public void setText(String str) {
                FontMetrics fm = getToolkit().getFontMetrics(getFont());
                BufferedReader br = new BufferedReader(new StringReader(str));
                String line;
                int maxWidth = 0, lines = 0;
                try {
                    while ((line = br.readLine()) != null) {
                        int width = SwingUtilities.computeStringWidth(fm, line);
                        if (maxWidth < width) {
                            maxWidth = width;
                        }
                        lines++;
                    }
                } catch (IOException ex) {
                    System.out.println(ex);
                }
                lines = (lines < 1) ? 1 : lines;
                int height = fm.getHeight() * lines;
                setPreferredSize(new Dimension(maxWidth + 6, height));
                super.setText(str);
            }
    
            void setSelect(boolean isSelected) {
                Color bColor;
                if (isSelected) {
                    bColor = UIManager.getColor("Tree.selectionBackground");
                } else {
                    bColor = UIManager.getColor("Tree.textBackground");
                }
                super.setBackground(bColor);
            }
    
            void setFocus(boolean hasFocus) {
                if (hasFocus) {
                    Color lineColor = UIManager.getColor("Tree.selectionBorderColor");
                    setBorder(BorderFactory.createLineBorder(lineColor));
                } else {
                    setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));
                }
            }
        }
    }
       
    but the two methods in the event of failure in a Windows look and feel, can anyone help with this?

    Published by: user8978073 on April 30, 2011 10:24

    Published by: user8978073 on April 30, 2011 10:25

    Can't check right now, but - afair, windowsLAF sets the rowHeight to a fixed value (16 or 18 or something like that). Consult the setRowHeight and make sure that there<= 0="" to="" indicate="" that="" it="" should="" be="">

  • I need script to remove the line with 2 points, another script to remove next lines

    I need script to remove the line with 2 points, another script to remove next lines of two scripts needed help please

    Thanks in advance

    Concerning

    Lakshmiganth

    Scroll through each pathitem and look at the length of his pathPoints group.  If the length is equal to 2 and then use the remove() method to remove it.  For example (this is rough, off the top of my head):

    var lines = new Array();

    for (i = 0;  I have< app.activedocument.pathitems.length; ="" i++)="">

    If (app.activeDocument.pathItems [i].pathPoints.length == 2) {}

    Lines.push (App.activeDocument.pathItems [i]);

    }

    }

    for (i = 0;  I have< lines.length; ="" i++)="">

    Lines [i]. Remove();

    }

  • model of multi line search with as

    Hi all

    I use oracle 9i. I want to search for multi - line pattern.

    for example

    Update tablename
    Set the columnname.

    I used select * from user_source where text like "update tablename set columnname %" but this only seems to work if update tablename set columnname is in the same line.

    Thank you.

    Well, no wonder it doesn't work. USER_SOURCE stores a single line of text per line, so the text in the column by definition cannot contain the multiline strings. One solution could be a LEAD analytic function:

    SQL> create or replace
      2    procedure p1
      3      is
      4      begin
      5          update emp
      6             set ename = ename;
      7  end;
      8  /
    
    Procedure created.
    
    SQL> select  distinct name
      2    from  (
      3           select  s.*,
      4                   lead(text) over(partition by name order by line) next_text
      5             from  user_source s
      6          )
      7    where text like '%update emp%'
      8      and next_text like '%set ename%'
      9  /
    
    NAME
    ------------------------------
    P1
    
    SQL> 
    

    SY.

  • Pass the Shell script variable to the plsql block

    Hello
    I have a shell script and pass the parameter of Shell script in a PLSQL block, I use the code but impossible to get any result, below
    Can someone help me with this issue?

    Shell script: test.sh


    * #! / bin/sh *.

    var1 = $1

    SQLPLUS = 'sqlplus-s ".
    Login = "gmisowner/gmisowner1".

    day ='$SQLPLUS $LOGON < < ++
    set the position
    Set feedback off

    Start
    select count () from mis_ref_codes where ref_description = & var1; *

    end;

    "exit";
    ++`

    echo $day

    Execution at the command prompt: >./test.sh Underline
    returns nothing

    1. I was hoping the count (*) in the number of lines in him select statement is stored in the day, but nothing returned as output of the plsql block
    the select statement above is an example, but I'll have to run a much larger plsql block

    I have syntactically doing something wrong? Please suggest

    Published by: Camilla January 14, 2012 12:35

    First of all you needget get rid of anonymous PL/SQL block:

    var1=$1
    
    SQLPLUS="sqlplus -s"
    LOGON="gmisowner/gmisowner1"
    
    day=`$SQLPLUS $LOGON <<++
    set heading off
    set feedback off
    select count(*) from mis_ref_codes where ref_description=&var1;
    exit;
    ++`
    echo $day
    

    But it still does not work. Your SQL * more script a proxy & var1. It has nothing to do with shel environment variable var1. That is why SQL * PLus prompts you to enter the value just after she readings

    Select count (*) in the mis_ref_codes where ref_description = &var1;

    And since you redirected input to your script, you must put value of var1, which isn't what you want, right? So what you need is:

    dev > # I'll set $1 to X
    dev > set X
    dev > var1 = $1
    dev > SQLPLUS = 'sqlplus-s ".
    dev > login = ' / '.
    dev > ='$SQLPLUS $LOGON < < EOF
    > set position
    > leave your comments
    > set verify off
    > select ' Have a nice day! "twice where dummy ="$var1 ";
    > "exit";
    > EOF'
    dev > echo $day
    Good day!
    dev >

    SY.

    Published by: Solomon Yakobson on 13 January 2012 15:17

  • CDF to run commands / Shell scripts

    Hi friends,

    I need help serious here regarding the CDF function.

    I created a JAR file to run batch/shell scripts via the calculation script.

    I tested the JAR file and it works perfectly well that run without the calculation script, but I get errors including in Calc script, I get the error message.

    Initially, the error was: error of Machine virtual Java and later, it is class not found.

    Here are the steps to register the CDF:

    1. place the JAR file in the location: E:\Oracle\Middleware\EPMSystem11R1\products\Essbase\EssbaseServer\java\udf\

    2. update the file udf.policy with the following statement:

    Grants all permissions to BatEx

    give the code "file:${essbase.java.home}/BatEx.jar" {}

    permission java.security.AllPermission;

    };

    3 restart the Essbase services.

    4. I am trying to create this function at Global level so no mention is not the name of the Application in the MaxL at registration:

    create or replace function '@BatEx' as

    "BatEx.

    Spec '@BatEx(Complete path in double quotes) '.

    Comment "Functions A CDF that runs the batch file in Essbase Server";

    5 this is the calc script:

    @BatEx 'E:/Oracle/Middleware/EPMSystem11R1/common/utilities/Test.bat '; -It gives an error: error: invalid syntax 1012000 - not a command CALC [@BatEx]

    I tried another way:

    RUNJAVA @BatEx 'E:/Oracle/Middleware/EPMSystem11R1/common/utilities/Test.bat '; -Gives an error: problem running [@BatEx 'E:/Oracle/Middleware/EPMSystem11R1/common/utilities/Test.bat']: [can't find @BatEx class]

    Where I am wrong here? Please help me out here.

    Kind regards

    RB

    Thanks much Amit and Jake! I finally cracked!

    Sad thing is that I have found no OTN correct information regarding function Java Custom, rather there was a lot of information about CDFs pre-existing provided by Oracle, so I decided to write a complete solution of CDF, where Java code too was created by the developer of Essbase applications.

    The requirement that I had was to trigger the batch file in the calculation script. Here is the detailed requirement:

    Update Variable of Substitution by planning web form.

    1. the user enters the data in the form of the planning web and saves it.

    2. the calc script attached to the web form, extracts data and records the flat file on Essbase server.

    3. earlier we were executing the script batch on the web server as the workflow will identify the lots on the web server and not on Essbase server, but after the development of this CDF to run the batch job, the batch files can be run directly Essbase server.

    4. the idea is to keep the user limited to the tasks list, so that it does not jump to the to-do list to SubVar web form, workflow and then return to the task list for a simple job to change SubVar.

    There were a few challenges that I encountered during the development of this JAVA function, namely:

    1 function CDF records do not : I tested JAVA code separately using command line and the executable Jar file will execute the batch, as expected. But I couldn't get why my CDF is not have recorded trace. After a lot of searching on Google and analysis, I found that it was the difference between the Version of JAVA (the JAVA compiler I used to compile and create my JAR file) and JAVA (JVM Essbase) virtual machine. I used JDK 1.7 update 65 to compile and create my POT so that the JVM used in the Essbase Server Update 1.6 is 35. I uninstalled JDK 1.7 of my machine, downloaded Update 1.6 35 archives of the Oracle and recompiled the code. Guess what! My CDF function was recorded first.

    So always check the compatibility of the Version of the JDK you used to compile and create the JAR file and JVM on your Essbase server.

    You can check the version of the JVM in console EAS-> EssbaseCluster-> right click-> Edit-> properties-> tab environment. There is a line that appears something like:

    ; JvmModuleLocation $J (EPM_ORACLE_HOME)-...-jdk160_35\jre\bin\server\jvm.dll (the bold is your version of the JVM).

    2. "main class not found" error after successful registration of CDF:

    I haven't had that one category of Public in my JAVA code and this error took me by surprise. I also checked the "public static void main" section in my code and everything seems to be OK. Please note that JAVA is case sensitive - 'hand' and 'Hand' aren't even in JAVA.

    I did some further research and one of John's response to a CDF request, I came to know that I need to include another argument (context) in the main section of my Java code and recompile with classpath "essbase.jar" (I will explain the controls in the next steps). I changed the main section of my JAVA code and included the argument:

    Public Shared Sub main (paramContext context, String [] paramArrayOfString)

    The following JAVA code to perform the batch in Essbase Server:

    import com.hyperion.essbase.calculator.Context;

    import java.io.BufferedReader;

    import java.io.InputStream;

    import java.io.InputStreamReader;

    import java.io.OutputStream;

    import java.io.PrintStream;

    public class BatEx

    {

    Public Shared Sub main (context, paramContext, String [] paramArrayOfString)

    {

    Try

    {

    String str1 = paramArrayOfString [0];

    LocalProcess process = Runtime.getRuntime () .exec (str1);

    InputStream localInputStream1 = localProcess.getInputStream ();

    OutputStream localOutputStream = localProcess.getOutputStream ();

    InputStream localInputStream2 = localProcess.getErrorStream ();

    BufferedReader in = new BufferedReader (new InputStreamReader (localInputStream1)) localBufferedReader;

    String str2;

    While ((str2 = localBufferedReader.readLine ())! = null) {}

    System.out.println (str2);

    }

    System.out.println ("package executed successfully.");

    }

    catch (Exception localException)

    {

    System.out.println ("error!:" + localException);

    localException.printStackTrace ();

    }

    }

    }

    Install the (compatible to Essbase JVM) compatible version of the JDK on your machine. Compile the above code by using the following command:

    C:\ >javac - classpath essbase.jar BatEx.java - please specify the path to the file "essbase.jar". It generally to the location: : \Oracle\Middleware\EPMSystem11R1\products\Essbase\EssbaseServer\java\

    The code should compile without any problem, and a .class file must be created with the same name.

    Now is the time to create the JAR file. Use the following command:

    C:\ >jar cf BatEx.jar BatEx.class

    Now the executable JAR file must also be created.

    Place this JAR file: : \Oracle\Middleware\EPMSystem11R1\products\Essbase\EssbaseServer\java\udf\

    Restart the service of Essbase and application (the only Application Restarting should work, but I didn't take any chances to restart both).

    Check the log of function CDF recording applications. The application log should be at the location:

    : \Oracle\Middleware\user_projects\epmsystem3\diagnostics\logs\essbase\essbase\app\-

    The CDF enrollment message should be something like:

    External function of [GLOBAL] [@BatEx] saved OK

    I used the following MaxL to register my function in Essbase:

    create or replace function '@BatEx' as

    "BatEx.

    Spec '@BatEx (StringArray).

    Comment "Functions A CDF that runs the batch file in Essbase Server"

    I used the following script to calc to run my CDF (fairly simple however):

    ESS_LOCALE English_UnitedStates.Latin1@Binary

    RUNJAVA BatEx "": / Oracle/Middleware/EPMSystem11R1/common/utilities/Test.bat ";" -Note: please replace with the name of the physical drive.

    I went and checked the logs that the Test.bat written and "wallah! The log file had some content and 1 KB in size. I deleted the contents of the log file and checked again, the result was the same.

    Hope this answer helps all of us who work on CDF that is clean.

    Please like this post if this can help you in some way.

    Thanks again to Amit, Jake and John for helping me solve this puzzle.

    Kind regards

    Amit Kumar Singh

  • pl/sql to java shell script

    This issue crosses many boundaries, but it begins with PL/SQL, and I hope that there is sufficient expertise here in order to cover the basics.

    System: Oracle 11.2.0.1.0 on Oracle 5, 64 - bit Linux

    I have a PL/SQL, java appeal procedure, which in turn calls a shell script. I put a few diagnostic output in the shell script, the redirection of stdout to a file in / tmp. running the script from the command line works perfectly. When it is called by procedures, no output.

    Here is the 'chain of traceability', somehow...

    In the PL/SQL:
    Host_Command (p_command => v_command||v_control_file||v_orasid);
    where the variable v_command = /opt/u01/app/oracle/admin/control/sqlldr3_test.script


    So this is 'Host_command', the whole procedure procedure:
    CREATE OR REPLACE  PROCEDURE "DW"."HOST_COMMAND" (p_command  IN  
        VARCHAR2)
    AS LANGUAGE JAVA
    NAME 'Host.executeCommand (java.lang.String)';
    And the shell script /opt/u01/app/oracle/admin/control/sqlldr3_test.script:
    #!/bin/ksh
    export trcfle=/tmp/edstest.$$
    export ORACLE_SID=$2
    export ORACLE_HOME=/u01/app/oracle/product/11.2.0/dwdev
    export PATH=$PATH:/u01/app/oracle/product/11.2.0/dwdev/bin
    export ORACLE_BASE=/u01/app/oracle
    export SQLLDR_CONTROLFILE=$1
    #
    echo input parms are $* >> $trcfle
    echo environment is: >> $trcfle
    env|grep -i ORACLE|grep -v grep|sort >> $trcfle
    #
    exit
    but in the end, there is no /tmp/edstest.* file
    oracle$ ls -ltr /tmp/eds*
    ls: /tmp/eds*: No such file or directory
    oracle$
    open to all ideas.

    I cut things down to their bases, but with the exception of the line of the high level process, the code above is finished... is that my test cut original scripts to exactly what is show. Requriement of business is to take existing scripts and remove some of the stuff that is hard coded, allowing procedures move from dev to qa to prod without hardcoded values unique to each environment.

    I'm very comfortable with PL/SQL and more with shell scripts, but the java link is a black hole for me.

    When the proc of Java runs the external command, a child process of Unix/Linux is created for it. This process inherits the environment settings of the parent process - that would be a dedicated server process, a work process or shared in the pool of the MTS server process.

    These processes have parameters of environment of bare bones and something fundamental that + $PATH + should not be approved as being valid and usable.

    If the Java code should fully qualify the path to the executable file to run.

    Java code should do 2 things - stdout (and stderr if possible) back to the appellant to PL/SQL as vacrhar2 of the parameters out. And return the exit code of the child process.

    They help a lot in troubleshooting why an outgoing external call failed.

    We use these external calls widely enough (through a number of interfaces, treatments to distance running and pulling on the release of data by the latter in the database). All driven from PL/SQL using the proc of Java to make an outgoing call. If the basics are working-, but there seems to be a constant learning and troubleshooting curve to follow to get this working in a robust way.

  • ESXi 4.0 underperformance (one quarter) of the workload on Linux (shell scripting) - specific example given

    Hi everyone;

    Basics:

    Our vmware environment is vmware esxi 4.0 on an IBM x 3650, double quad-core processors, 32 GB RAM, 6 x 450 GB 15 k RPM WHAT drives (local). There is a single guest from vmware that is inactive except for this test. The guest is a RHEL 5.3 x86_64 only fully patched host. Best practice: current version of vmware tools is installed, vmxnet3 driver is used, the kernel startup params are notsc divisor = 10, all 6 discs are in a raid10 table, elevator is set to noop.

    The above, vmware environment with regard to performance, is facing a 5 year, IBM x 336, who has a copy of RHEL installed.

    Scenario:

    We have shell scripts which runs a software installation rather complicated. Without getting too inside, scripts to make a ton of calls of subroutines (e.g. VAR = $(écho $line | cut-f1-d:)). This script works horribly slow in the new vmware and vmware environment otherwise slow (less than 1/2 the speed, perhaps only 1/3 the speed) 5 year old physical server. Because the operation is an operation of 15 minutes in the best of times, it takes 30-60 minutes to complete, on a new server.

    As a test case, I made this script (yes I know 'let i = i + 1' would be faster, but do not reflect the actual workload.)

    #! / bin/sh

    I have = 0

    While------[$i - lt 1000]

    do

    I have = $(echo "$i + 1" | bc)

    fact

    I then run this script (which basically incriments I from 0 to 1000) and time. I the time using an external timer because I know that vmware can distort a bit sometimes. However, the results represent the picture. The script above takes about 8.5 seconds on the guest operating system and about 2.25 seconds on the physical host computer. Basically, it is considerably slower.

    I have read the 3 VI and vSphere 4 practices better performance... I read that potentially binary translation and VMware could cause a problem, or the fork then the/bin/sh is slow on vmware (some article strange re Zap?) ... but I'm curious to know if anyone has had similar experiences or recommendations? For the guys out there linux, RHEL and other suppliers, the above script gives also a second 8-10 response?

    For the people of vmware, y at - it something on bash (/ bin/sh) which makes it slow... especially on iterations () $ who call/bin/sh and more? I tried to replace the above $i = with 'I = i + 1' and it ends in less than a second and I tried to add a true/bin/in the mixture of execution, and he had a minimal impact on the speed (currently testing the forkO / exit() combo - and re - write this particular program/script I know is an option, do not write say to do)

    Any comments welcome, thank you

    MMU operations-hungry as fork/exec run a lot faster on processors AMD with IVR, that we support with ESX 3.5 and Intel processors with EFA, requiring vSphere.

    Scott

    More information on my blog of the communities and on Twitter:

    http://communities.VMware.com/blogs/Drummonds

    http://Twitter.com/Drummonds

  • How to solve this problem in shell script: unexpected end of file

    Hello

    I need to connect to each of the databases listed in/etc/oratab and check what database is stopped (or mounted only) and what database is opened to accept the connection. However, the following shell script gives me this error message:

    $>./check_is_db_runing.sh
    . / check_is_db_runing.sh: line 39: syntax error: unexpected end of file

    Could someone please help me solve this problem, why the code (line 29 to 32) does not work in the LOOP? It works without the LOOP.

    Thanks in advance!



    1 #! / bin/bash
    2
    3 LOGDIR = / oracle/data03/dbscripts
    4 ORATABFILE = / etc/oratab
    5
    6 cat $ORATABFILE | read everything online
    7 do
    8-case $LINE in
    9 \#*) ;; Comment # line in oratab
    10 *)
    11 ORACLE_SID ='echo $LINE | AWK - f: '{print $1}'-'
    12 if ['$ORACLE_SID' = ' *']; then
    13 # NULL SID - ignore
    14 ORACLE_SID =""
    continue 15
    16 IFS
    17
    # 18 continue only if the last field corresponds to 'Y '.
    19 if ["' echo $LINE | '] [' awk - f: '{print $NF}'-' "="Y"]; then
    20 if [' echo $ORACLE_SID | cut b 1'! = '+']; then
    21
    22 ORACLE_HOME ='echo $LINE | AWK - f: '{print $2}'-'
    23 PATH = $ORACLE_HOME/bin: / bin: / usr/bin: / etc
    24 export ORACLE_HOME ORACLE_SID, PATH
    LOGFILE = $25 LOGDIR/check_$ ORACLE_SID.log
    26 touch $LOGFILE
    #echo 27 $LOGFILE
    28
    $29 ORACLE_HOME/bin/sqlplus - s "/ as sysdba" < < EOF > $LOGFILE
    30 select * from global_name;
    exit 31
    32 EOF
    33
    34 fi
    35 fi
    36;
    ESAC 37
    38 fact

    This code works IE. produces newspapers with result sql - slightly modified to be executable:

    #! / bin/bash

    LOGDIR = / tmp
    ORATABFILE = / etc/oratab

    Cat $ORATABFILE | read everything online
    do
    case $LINE in
    \#*) ;; Comment # line in oratab
    *)
    ORACLE_SID ='echo $LINE | AWK - f: '{print $1}'-'
    If------[-z $ORACLE_SID-]; then
    # NULL SID - ignore
    ORACLE_SID =""
    continue

    # Only if the last field corresponds to 'Y '.
    on the other

    ORACLE_HOME ='echo $LINE | AWK - f: '{print $2}'-'
    PATH = $ORACLE_HOME/bin: / bin: / usr/bin: / etc
    export ORACLE_HOME ORACLE_SID, PATH
    LOGFILE = $logdir/check_$ ORACLE_SID.log
    Touch $LOGFILE
    #echo $LOGFILE

    $ORACLE_HOME/bin/sqlplus - s "/ as sysdba" < eof=""> $LOGFILE
    Select * from global_name;
    output
    EXPRESSIONS OF FOLKLORE

    FI
    ;;
    ESAC
    fact

Maybe you are looking for