How to check from a shell script that a particular software is installed

Hai friends
I want to write a shell script which has to check whether a particular software is installed on the machine, or not. If installed, then what version is it using and the get the version number and which type of installer is it? i mean is it a .rpm installation or a tar.gz installation.
how can i check this from a shell script. If any of you have any idea please give me a sample script to check this
Thank you

@Raja_Abilash
I don't think this is a right thread & right forum to POST this question.
better go ahead with forums related to LINUX.

Similar Messages

  • Starting tomcat from a shell script

    Hello-
    I want to start Tomcat from a shell script that is called by an application on a web page. Problem is, the app that calls the script runs as user nobody.
    I'm a permissions noob, so any suggestions as to how I could get this working are appreciated.
    Will

    Tomcat should be running if you intend to use it as a service.
    You don't want people to be able to start (or.. stop !) services on your server from a web page... That would present a gaping security hole.

  • Reading variables from a shell script

    i was wondering if it is possible to enter variables from a shell script that an sql file can use:
    ex:
    shell script file
    #!/bin/ksh
    stty -echo
    read pwd?"Enter password for user: "
    echo
    stty echo
    read var?"Please enter value for variable: "
    echo
    $ORACLE_HOME/bin/sqlplus user/$pwd @TEST.sql
    sql file TEST.sql
    set serveroutput on
    set verify off
    spool out.log
    update table set parameter_value = '$var' where parameter_name = 'X';
    commit;
    exit;
    spool off;
    i tried that and it seems its updating my table with "var" and not what the user entered that is the bind variable $var
    am i missing something?

    if user hits enter (which means null) can the program
    not end and ask the user to enter another value?Try this way :
    while :
    do
            echo -n "Please enter value for variable: "
            read VAR
            if [ "$VAR" ]; then
                    break
            else
                    continue
            fi
    done

  • How can i call a shell script from procedure

    I have a shell script.now i am i a situation to call that shell script from one of my procedures and need to get a value from that script.
    can u suggest me that how can a call the shell script from pl/sql?

    Is the same question you asked here
    How to call Shell Script from pl/sql block
    -SK

  • Can any one tell me how can i call a shell script from pl/sql

    i like to call shell script from pl/sql procedure.
    can any one suggest how can i do this

    Have you not mastered in asking the same kind of question ?
    First do write a script...
    no one will spoon feed you.
    How can i call a shell script from procedure
    How to call Shell Script from pl/sql block
    -Sk

  • How to Reset dbid from a Shell Script

    I would like to use a shell script to:
    1) Automate the restore of our Produciton backups to a different server
    2) Reset the dbid prior to exiting the script
    Is there a way to reset the dbid from a shell script?
    When I use the following, it has an interactive prompt in the middle of it, and I don't see anything in the syntax diagram found in the "Oracle Database Utilities" manual that will let me get around this.
    nid target =/
    DBNEWID: Release 10.2.0.3.0 - Production on Fri Aug 8 09:37:04 2008
    Copyright (c) 1982, 2005, Oracle. All rights reserved.
    Connected to database DRTEST (DBID=3725550444)
    Connected to server version 10.2.0
    Control Files in database:
    /s01/oradata/drtest/control01.ctl
    /s01/oradata/drtest/control02.ctl
    /u01/oradata/drtest/control03.ctl
    Change database ID of database DRTEST? (Y/[N]) => y
    Proceeding with operation
    Changing database ID from 3725550444 to 3752603328
    Control File /s01/oradata/drtest/control01.ctl - modified
    Control File /s01/oradata/drtest/control02.ctl - modified
    Control File /u01/oradata/drtest/control03.ctl - modified
    Datafile /s01/oradata/drtest/system01.dbf - dbid changed
    Datafile /s01/oradata/drtest/undotbs01.dbf - dbid changed
    Datafile /s01/oradata/drtest/sysaux01.dbf - dbid changed
    Datafile /s01/oradata/drtest/users01.dbf - dbid changed
    Datafile /s01/oradata/drtest/rman.dbf - dbid changed
    Datafile /s01/oradata/drtest/temp01.dbf - dbid changed
    Control File /s01/oradata/drtest/control01.ctl - dbid changed
    Control File /s01/oradata/drtest/control02.ctl - dbid changed
    Control File /u01/oradata/drtest/control03.ctl - dbid changed
    Instance shut down
    Database ID for database DRTEST changed to 3752603328.
    All previous backups and archived redo logs for this database are unusable.
    Database has been shutdown, open database with RESETLOGS option.
    Succesfully changed database ID.
    DBNEWID - Completed succesfully.

    ... When I use the following, it has an interactive
    prompt in the middle of it, ...You may want to try out "Expect" for automating any interactive script.
    isotope

  • How to check from code in Excel Addin that Excel is embedded in Microsoft word

    We've developed an Excel Addin in C# for Excel 2010 and it works perfectly OK. But one issue is reported very recently as below.
    1. Microsoft word document is created with an embedded excel work sheet.
    2. Save the document and close.
    3. Open the word document and try to edit the work sheet there.
    4. Following error comes.
    "The program used to create this object is Excel. That program is either not installed on your computer or it is not responding.
    To edit this object, install Excel or ensure that any dialog boxes in Excel are closed."
    5. This is because, our Addin is initialized and one excel process is running.
    6. If the Excel Addin is disabled, above work flow works correctly.
    Please let me know how to determine from the Excel Addin that the excel worksheet is embedded in another applicatoin. Because I want to disable the Addin in those cases and enable it if the Excel is opened standalone. The Addin is developed in C#.

    Hi,
    Since the error message, please try to install this Hotfix test if it works:
    http://support.microsoft.com/kb/2596494
    Note: Delete the Excel instance running in the background(Go to your task manager and delete it) before opening your Word document and edit your embedded Excel.
    If the issue still exists, please see the article and try the solution which I copied here:
    "The basic simple answer is to place a Marshal.ComReleaseObject(Wb) at the end (or better, in the Finally block) of your event handlers. This will properly allow Word and excel to handle the OLE communication by not having VSTO hang on to an instance
    handle of the workbook, therefore causing the error.
    And this is not carte blanche to start placing ComReleaseObject() all over your code. I have found VERY VERY few limited cases where using ComReleaseObject() in an add-in necessary. And this is one of them."
    http://davecra.com/2012/10/09/vsto-and-comole/
    Please Note: Since the web site is not hosted by Microsoft, the link may change without notice. Microsoft does not guarantee the accuracy of this information.
    Regards,
    George Zhao
    TechNet Community Support

  • Need to call Shell script that uses SQL loader in APex4.1/11g

    Hi there!
    I have a requirement, wherein I have to call a shell script that connects to an external server, ftp's a file in and then uses sqlloader to load data into our table. Now we have the ftp script that does this for another program, but is a scheduled job. I wanted to call the ftp shell script from within APEX. Any suggestions on how this can be done, what PL/SQL logic can we use? I see online some people using dbms scheduler for this?
    Thank you
    Sun

    Hi,
    Create some sh script on your oracle host machine where you can join into external server and run the process.
    something like:
    run_external_sh.sh
    #!/bin/sh
    ssh ext_user@ext_host ./sqlloader/import/import.shThen create a external JOB to call it via ORACLE(PL/SQL)
    -- Call Shell Script.
    BEGIN
      DBMS_SCHEDULER.create_program (
        program_name        => 'external_call_sh',
        program_type        => 'EXECUTABLE',
        program_action      => '/local_host/call_external/sh/run_external_sh.sh',
        number_of_arguments => 0,
        enabled             => TRUE,
        comments            => 'Call external SH script');
    END;
    /Now you can create a scheduled/or not scheduled JOB
    -- Job defined by an existing program and schedule.
    BEGIN
      DBMS_SCHEDULER.create_job (
        job_name      => 'jb_external_call_sh',
        program_name  => 'external_call_sh',
        schedule_name => 'external_call_scheduler', -- created scheduler
        enabled       => TRUE,
        comments      => 'Job defined by an existing external_call_sh program and schedule.');
    END;
    /Now you can call the JOB in APEX in PL/SQL process.
    BEGIN
      -- Run job synchronously.
      DBMS_SCHEDULER.run_job (job_name            => 'jb_external_call_sh');
    END;Regards
    J :D

  • Ways to run a shell script that starts a python script

    I have a shell script that is used to launch a python (2.5.1 installed via Fink) script (IDLE). The shell script, the IDLE script, and the python binary are all in /sw/bin as usual. This all has to be done AFTER X11 has been launched. I have to make this easy for my students to use.
    In each account's home .xinitrc file, I have the lines
    source .profile
    vpython2.5 *
    and this works, but it calls the vpython2.5 script every time X11 is launched. I've tried adding the vpython2.5 command to the X11 Applications menu, but this works ONLY if I add /sw/bin to the script name. Apparently the menu doesn't "know" about the current PATH setting. The keyboard shortcut I put in the menu neither shows up nor works either. So much for that option.
    Now I've discovered Platypus and it looked promising, but I'm obiously not using it correctly and from the documentation, I can't figure out what I'm doing wrong.
    So here's the ultimate question. Is there a way to use Platypus to encapsulate the vpython2.5 script, preferably also starting up X11, so students will only have to click on the new app's icon? This is how OpenOffice.org starts up. It seemed simple enough to do in Platypus, but I never saw the IDLE window open up.

    I added a shortcut key "j" for the "xman" app in X11, and it seems to work fine. Did you press the command key with the shortcut key? Are you sure the shortcut key you selected does not overlap with others in the menubar?
    There should be no problems creating an application with Platypus using a shell script. In my experience, you have to source all necessary files, assuming that the shell script does not recognize your terminal settings. You can also launch X11.app in the shell script with the following command:
    command open -a X11
    It is a good idea to pause the shell script until X11 finishes launching. To do this, you need a command like,
    command sleep 5
    Otherwise, if you try to start X11-dependent apps in the shell script while X11 is launching, it will fail. There may be better ways to do this.
    Hope this helps.

  • Passing Multiple Parameters to SQL Script from a Shell Script

    Hi Friends,
    I have SQL script which accepts 6 parameters.
    I am calling this from a shell script as shown below:
    sqlplus -s  ${ORACLE_ID} @${SQLPATH}KORONT_041.sql ${USER_ID} ${PDC} ${item_number} ${KORDC} ${PDCSET} ${last_Updated_in_hours} Out of the six parameters, item_number is not a mandatory parameter.
    When i pass all six parameters, there is no issue.
    But when i leave item_number blank, i am getting the below error
    Enter value for 6:
    User requested Interrupt or EOF detected.Based on the error, it seems that the NULL values for item_number is ignored and SQL*PLUS is waiting for one more input from user.
    How can i overcome this issue?
    Regards,
    Sreekanth

    Hi,
    I am calling the shell script from concurrent program and below is the log file of the concurrent program.
    Copyright (c) 1979, 1999, Oracle Corporation. All rights reserved.
    KORONT_041_SH module: KORONT - Daily Item Master Update
    +---------------------------------------------------------------------------+
    Current system time is 29-JUN-2011 10:09:35
    +---------------------------------------------------------------------------+
    REQUEST_ID: 68510795
    USER_ID: 4219
    PDC:    85
    Item Number:
    KORDC:    124
    PDCSET:   1100000003
    last_updated_in_hours: 24
    EMAIL_ID: [email protected],[email protected]
    SQLPATH: /e381/oracle/asodev01appl/custom/motont/1.0.0/sql/
    RPTDIR:  /e381/oracle/asodev01comn/admin/out/ASODEV01_asoprdb2
    RPTFILE: o68510795.out
    Table truncated.
    *Enter value for 6: User requested Interrupt or EOF detected.*
    Table truncated.
    old  15:       AND ic.organization_id   = &&4
    new  15:       AND ic.organization_id   = 1100000003
    0 rows created.
    Input truncated to 9 characters
    old   8:                AND organization_id   = &&4
    new   8:                AND organization_id   = 1100000003
    0 rows created.
    End of SQL
    No record.
    +---------------------------------------------------------------------------+
    Executing request completion options...
    +------------- 1) PRINT   -------------+
    Printing output file.
                   Request ID : 68510795      
             Number of copies : 0      
                      Printer : noprint
    +--------------------------------------+
    Finished executing request completion options.
    +---------------------------------------------------------------------------+
    Concurrent request completed successfully
    Current system time is 29-JUN-2011 10:09:38
    +---------------------------------------------------------------------------+Regards,
    Sreekanth

  • Is it possible to pass a variable from a shell script back to an Automator action?

    Is it possible to pass a variable from a shell script back to an Automator action?
    For instance, if I assign a value of foo to $var1 in my shell script how would I retrieve/pass that value in the next Automator action. I see that there is a variable called "Shell Script" but I can't any information on how to use it. 

    red_menace,
    Thanks but I still don't understand how to pass a single value that was set in the UNIX scipt back to Automator has a variable. Take the example below, I write 4 varables to STDOUT and all 4 are stored in a variable named "storage".  How do I assign 1 of these values to the Automator "storage" variable? For instance if I wanted to assign the value of $var2 to "storage" , how would I do that?

  • Debugging a program being called from a shell script

    hi All,
    i want to know how debug a C program being called from A Shell Script,
    my script looks like the following :
    ecReqProcMain $Cfg/ecReq.g $TotCnt 2>> $ErrFilei also have to pass some arguments to the script itsellft, which in trun going to pass it to the program,
    also in some cases i may be required to Pipe some data to the program, like the folowing
    cat DataFile | myProgramThanks ,

    You can also use ss_attach with the scheme that Anton
    suggested above. Instead of inserting "dbx" into your
    script, insert "ss_attach" into your script.
    It's also possible to change your script to something like this:
    cat DataFile | ${DEBUG} myProgram
    Then you can run your script like this:
    setenv DEBUG ss_attach
    ecReqProcMain $Cfg/ecReq.g $TotCnt 2>> $ErrFile
    --chris                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Calling a report from unix shell script

    Hi,
    I had to call a report from unix shell script.
    May i know the procedure to accomplish this
    Thanks in Advance
    A.Gopal

    First you should not include the whole path to your report in the call ...
    Use like this:
    /ora/u01/oracle/v101/as2/bin/rwrun.sh report=an_stati destype=file desname=/ora/u01/oracle/v101/as2/test.pdf desformat=pdf
    In $ORACLE_HOME/bin/reports.sh:
    1) Verify that you have updated the REPORTS_PATH variable to include your folder where you have the report in question
    REPORTS_PATH=/ora/u20/app/qits/env1/run:$ORACLE_HOME/reports/templates:$ORACLE_HOME/reports/samples/demo: ....
    2) Verify that the REPORTS_TMP variable is pointing to a valid location and that the oracle user has access to write on it.
    After that, post the content of the tracefile located at $ORACLE_HOME/reports/logs/{in-process report server name folder}/rwserver.trc
    If no file is present then it means that you need to enable trace in your reports's conf file.... go to the $ORACLE_HOME/reports/conf folder and and locate the .conf file that correspond to your in-process reports server name (as specified in the rwservelet.properties file)... open/edit the file to enable trace logs ..
    i.e.
    Change the following line:
    <!--trace traceOpts="trace_all"/-->
    to <trace traceOpts="trace_all"/>
    Bounce the reports server and try to run the report again, this time the .trc file should be generated, post the content so that we can take a look.

  • Calling stored procedure from unix shell script

    Hello,
    I am facing a problem while calling a stored procedure from UNIX shell script. I want to return a output variable from the stored procedure to the UNIX environment.
    Here is the code-
    #!/bin/sh
    OUTPUT=`sqlplus cmag/magnum@dw <<ENDOFSQL
    set serveroutput on;
    var prd_out varchar2(100);
    exec create_pm_window(:prd_out);
    exit;
    ENDOFSQL`
    echo " output is - $OUTPUT"
    The problem is :prd_out is not getting copied to shell variable OUTPUT.
    I have a dbms_output.put_line in the stored proc create_pm_window and I can see that prd_out is getting populated.
    Any help is really appreciated.
    Thanks'
    Rakhee

    First step :
    make sure the PL/SQL works as expected.
    Does the following display the expected output executed from SQL*Plus ?
    set serverout on
    declare
    prd_out varchar2(100);
    begin
    create_pm_window(prd_out);
    dbms_output.put_line('output is '||prd_out);
    end;
    I don't have your procedure, but using a dummy procedure like :
    Scott@my10g SQL>create procedure foo(p_out in out varchar2)   
      2  is
      3  begin
      4  select 'Hello '||instance_name into p_out from v$instance;
      5  end;
      6  /
    Procedure created. and a toto.sh script as :OUTPUT=`sqlplus -s scott/tiger <<EOF
    set pages 0 lines 120 trimout on trimspool on tab off echo off verify off feed off serverout on
    var mavar varchar2(100);
    exec foo(:mavar);
    print mavar;
    exit;
    EOF`
    echo "OUT = ${OUTPUT}"
    exitIt works fine :[oracle@Nicosa-oel ~]$ ./toto.sh
    OUT = Hello my10g

  • Error when running the OWB process flow from the shell script

    Hi,
    I am able to deploy the process flow succesfully but when I execute the process flow from the shell script,I am getting the following error.Previously it worked fine.
    I had to make some chnage in the IP address,so i had to deploy again.
    Connected.
    SQL> @/oracle/product/owb92028/owb/rtp/sql/oem_exec_template.sql OWB_RTR LOC_P_REL PROCESS P_W_SOURCE "," ","
    Elapsed: 00:00:00.00
    Elapsed: 00:00:00.01
    Stage 1: Decoding Parameters
    | location_name=LOC_P_REL
    | task_type=ProcessFlow
    | task_name=P_W_SOURCE
    Stage 2: Opening Task
    declare
    ERROR at line 1:
    ORA-01422: exact fetch returns more than requested number of rows
    ORA-06512: at "OWB_RTR.WB_RT_API_EXEC", line 17
    ORA-06512: at "OWB_RTR.WB_RT_API_EXEC", line 137
    ORA-06512: at "OWB_RTR.WB_RT_API_EXEC", line 164
    ORA-06512: at line 205
    Thanks in advance.
    Vinay

    Hi Kamal and kanakam kolla,
    This is just to let you know that,I solved my problem little differently by creating a new location and deployed the process flow.Now my process flow is working fine when i call from the shell script.What i see is that, it does not update properly when we update and redeploy the process flow.So far this is the work arround i could think off and i succesfully tested this.
    Thank you Kamal and kanakam kolla,for giving a thought towards my problem.
    Thanks
    Vinay

Maybe you are looking for