Linux Script doees not executed as cronjob

I have created a script b.sh as follows to get the status of Oracle Database
[oracle@accurman1 tmp]$ cat b.sh
#! /bin/bash
$ORACLE_HOME/bin/sqlplus -s < /tmp/1.sql >> /tmp/mylog.log
[oracle@accurman1 tmp]$
[oracle@accurman1 tmp]$ cat /tmp/1.sql
connect sys/xxx@orcl as sysdba
set heading off
set feedback off
set verify off
select 'STATUS:'||status from v$instance;
select 'MODE:'||log_mode from v$database;
[oracle@accurman1 tmp]$
when execute manually from command promp it executes properly and I get the sql output in mylog.log file
However if I schedule the script, b.sh , as cron job then it does not executes... and do not through any error.....
What is wrong here?
Message was edited by:
johnveslin

#! /bin/bash
$ORACLE_HOME/bin/sqlplus -s < /tmp/1.sql >> /tmp/mylog.log
What is wrong here?Environment. Cron doesn't know the enviroment of (oracle) user.
So set the environment (at least ORACLE_HOME) in your b.sh script.
as cron job then it does not executes... and do not through any error.....Usually when error occurs during cron execution it is mailed to user's inbox.
So try to log as that user (su - oracle) and try to execute "mail" command.
The other way how you can log the output and errors is (crontab entry example):
5 * * * * /home/oracle/bin/my_cron_script >> /tmp/my_cron_script.log 2>&1

Similar Messages

  • Scripts are not executing

    Hi,
    we have scheduled scripts through crontab,but from few days these scripts are not executing,there is no problem with time entries in crontab because some of them are executing correctly,what can be possible reasons for the cronjobs to not to execute.we are using sun solaris sparc 64 bit.oracle 10.1.0.4

    I can't say without knowing what the script does. Maybe somebody changed the permissions on another directory that script needs, or maybe another file it needs is no longer available, or ???
    Just suggesting a troubleshooting step. If you can run the script in a similar setup then you can eliminate the script as a likely problem. I didn't see anything on the crontab entry that looked to be a problem.
    PS: "will the date change with the execution of cronjob or it remains the same."
    No, the date on the cron daemon will stay the same. It just wakes up once a minute to check for things to do and kicks them off, it never restarts.

  • FormCalc script is not executed

    Hi everybody,
    I've developped a Pdf forms with FormCalc Script.
    This script does works in the preview designer of SFP transaction but when i try to run the pdf forms through a specific program, the script is not executed.
    Do you have any idea ?
    The pdf is a ZCI layout.
    My SAP platform is ECC 6.0

    Brice,
    What is the type of form you are developing ? Interactive or Print.
    My guess you be creating a Print form where dynamic scripting does not work.
    Alternatively put following line of code in the script to see if the control is transferred to your event or not.
    $host.messageBox("Inside event")
    Chintan

  • SSIS Script task not executing macro through SQL Agent (but it does through bids)

    <p>Hello everyone,</p><p>I am having an issue with SQL Agent when executing a macro contained in a script task component. The script task actually opens an excel file, runs the macro, save and closes the file. </p><p>When
    I execute the package via BIDS/Visual studio, it works like a charm. However, when i execute the package with SQL agent, the package runs successfully but it seems that the macro is not executed as the excel file has not been modified as it should have. Also,
    the history log does not show any error messages. </p><p>Could </p>

    Thanks!I did create a credential and a proxy too but still the macro is not executed.I have searched online for solutions but no one has experimented this kind of issue before it seems. Please have a look at the script task code:
    Imports
    Excel = Microsoft.Office.Interop.Excel
    Imports
    System
    Imports
    System.Data
    Imports
    System.Math
    Imports
    Microsoft.SqlServer.Dts.Runtime
    <System.AddIn.AddIn(
    "ScriptMain", Version:="1.0",
    Publisher:="", Description:="")>
    <System.CLSCompliantAttribute(
    False)> _
    Partial
    Public
    Class ScriptMain
    Inherits Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTARTScriptObjectModelBase
    Enum ScriptResults
    Success = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Success
    Failure = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure
    End
    Enum
    Public
    Sub Main()
    Dim Macro_name
    As
    String
    Dim ExcelObject
    As
    New Microsoft.Office.Interop.Excel.Application
    Dim oBook
    As Microsoft.Office.Interop.Excel.Workbook
    Dim oBooks
    As Microsoft.Office.Interop.Excel.Workbooks
    Try
    Macro_name =
    "Macro001"
    ExcelObject =
    CType(CreateObject("Excel.Application"),
    Excel.Application)
    ExcelObject.Visible =
    True
    ExcelObject.UserControl =
    False
    ExcelObject.DisplayAlerts =
    False
    oBooks = ExcelObject.Workbooks
    oBook =
    CType(oBooks.Open("C\Book1.xls"),
    Excel.WorkbookClass)
    ExcelObject.Run(Macro_name)
    Catch ex
    As Exception
    ExcelObject.Application.Quit()
    ExcelObject.DisplayAlerts =
    True
    ExcelObject =
    Nothing
    End
    Try
    Dts.TaskResult = ScriptResults.Success
    End
    Sub
    End
    Class

  • Script is not executed - Standard-TimeOut

    Hello, I have a problem with a script, that is debugged without mistakes, but is not executed anyway. The Script consists of the movie with a keyframe  that creates a new Instance for an Object that again creates a series of new Instances for another Object (array) that controls an associated Movieclip.
    The Error: A Script was executed longer than the Standard-Time-Out of 15 Seconds.
    If necessary, I will add the script.
    Thank you

    The Script shall create an endless flow of fonts that fall from top to bottem (a "matrix in serif")
    The Main Movie
    import testklassen.*;
    stop();
    var FontFlow1:FontFlow = new FontFlow();
    The "testklassen"-package:
    The First Object "Font" controls the Motion of the "FontMovieClip".
    package testklassen {
        import flash.display.*;
        import flash.display.MovieClip;
        import flash.utils.*;
        import flash.events.*;
        import flash.events.Event;
        import fl.transitions.*;
        public class Font {
                public var Counter:int;
                public var X_Position:int;
                public var Y_Position:int;
                public var Speed:int;
                public var myFrameRate:Number;
                public function Font (pCounter, pX_Position, pY_Position, pSpeed)  {
                    this.Counter = pCounter;
                    this.X_Position = pX_Position;
                    this.Y_Position = pY_Position;
                    this.Speed = pSpeed;
                    this.myFrameRate = 1000/32;
                    //Loop moves the FontMovieClip from the top to the bottom...
                    //The Motion consists only of Y-component.
                    root.FontMovieClips[Counter].play();
                    var timer:Timer = new Timer(myFrameRate, 100);
                    timer.addEventListener(TimerEvent.TIMER, goOn);
                        function goOn()  {
                        this.Y_Position += this.Speed
                        root.FontMovieClips[Counter].Y = this.Y_Position;

  • Script Runner Not Executing

    My script runner is not executing. I can run a simple statement such as select count(*) from mtl_system_items_b; with the Execute Statement. When I attempt to run the same statement using the Run Script command SQL Developer hangs up and never completes.
    I have not had any trouble with this in the past. It could have started with my latest upgrade. I'm running version 1.1.2.25 build MAIN-25.79

    It would have depended on when and how you did you update. Check for Updates was not available for updating from a 1.0 build to the 1.1 build. You could only use Check for Updates on a 1.1 build (or its subsequent patches) to reach 1.1.2.
    The latest release is 1.2.1.32.13 and requires a full fresh install. There is no Check for Updates available.
    Regards
    Sue

  • VB Script is not executing when deployig from SCCM 2012

    Manually my VB script is running successfully when executing from the Batch file which internally calls VB Script to suppress "HyperionSmartViewforOffice_11.1.2.1.0" add-in
    prompts pop up which occurs upon launching MS Excel.
    please  see the attached files for folder structure (Folderstructure.PNG), add-in pop up error (add in pop up error.PNG).
    Batch Script:
    @ Echo Off
    msiexec /x {62190FC2-D90E-45A8-9ED8-9C523EC426E2} /qn
    removeExcelOpenKey.vbs
    vb script :
    Dim objExcel
    Dim addin
    On Error Resume Next
    Set objWb = objExcel.Workbooks("myAddin.xla")
    If Not wb Is Nothing Then
    wb.RunAutoMacros xlAutoClose
    End If
    Set objExcel = CreateObject("Excel.Application")
    For i = 0 To objExcel.Addins.Count
        Set objAddin= objExcel.Addins.item(i)
        If objAddin.Name = "HsTbar.xla" Then
            objAddin.Installed = False
        End If
    Next
    objExcel.Quit
    Set objExcel = Nothing
    tried to fail deploying the package and application (follwed detection method file , registry , windows installer ) as well but no luck.
    appreciated help .
    thanks,

    Manually my VB script is running successfully when executing from the Batch file which internally calls VB Script to suppress "HyperionSmartViewforOffice_11.1.2.1.0" add-in
    prompts pop up which occurs upon launching MS Excel.
    please  see the attached files for folder structure (Folderstructure.PNG), add-in pop up error (add in pop up error.PNG).
    Batch Script:
    @ Echo Off
    msiexec /x {62190FC2-D90E-45A8-9ED8-9C523EC426E2} /qn
    removeExcelOpenKey.vbs
    vb script :
    Dim objExcel
    Dim addin
    On Error Resume Next
    Set objWb = objExcel.Workbooks("myAddin.xla")
    If Not wb Is Nothing Then
    wb.RunAutoMacros xlAutoClose
    End If
    Set objExcel = CreateObject("Excel.Application")
    For i = 0 To objExcel.Addins.Count
        Set objAddin= objExcel.Addins.item(i)
        If objAddin.Name = "HsTbar.xla" Then
            objAddin.Installed = False
        End If
    Next
    objExcel.Quit
    Set objExcel = Nothing
    failed to deploy the package and application (followed detection method file , registry , windows installer ) as well but no luck.
    appreciated help .
    thanks,
    Gc.Hanumareddy

  • Java script does not execute - help would be appreciated.

    How can i tell the user where they are based upon the page url?
    I have put the following script at the top of the large product page
    and have the latest version of js installed.
    <script type="text/javascript">
    if (document.location.href.match('brands')) {
    alert('dont forget you are on the brands page');
    else if (document.location.href.match('fish')) {
    alert('dont forget you are on the fish page');
    </script>
    Any help would be appreciated.
    Thank you.

    Hi Peter, Posting snippets of code is not really helpful, Need to see it running. You could have other script errors and we can better see what your trying to achieve.

  • Install script is not executed during installation of homemade package

    I'm working on my first PKGBUILD for the AUR, trying to create a package to install dphys-swapfile on Arch.
    Here are the files that I'm using to create this package:
    PKGBUILD
    dphys-swapfile.install
    dphys-swapfile.service
    The installation of dphys-swapfile as specified in the PKGBUILD works perfectly, i.e. it is actually installed to the right location and you can use it without any problems at all.
    The systemd unit file is copied to the right location as well and you can enable and start the service with systemctl.
    The problem arises with the install script. I wrote dphys-swapfile.install so that the service would be automatically enabled and started right after the installation of the package, but this is not working, i.e. the service is neither being enabled not being started, and I don't know what is causing this issue.
    Any insight on what could be failing, as well as general tips on how to improve this package, will be very much appreciated.
    Last edited by jonancm (2015-02-14 22:13:38)

    It looks like presets are the appropriate way to do this:
    systemctl preset is used by the post install scriptlets of RPM packages (or other OS package formats), to enable/disable specific units by default on package installation...

  • Linux Sh script is not running in forms10g(10.1.2)

    Hi
    The Oracle Forms server is installed in Linux.
    I have placed the below host commands in forms10g. The Host command is running but shell sh script is not executed.
    BEGIN
    :GLOBAL.DIR_PATH:='/forms/shell_files/';
    Host(:GLOBAL.DIR_PATH||'my_shell.sh'||' > '||:GLOBAL.DIR_PATH||'my_shell.log');
    END;
    I tried to execute the sh file and redirect the output to log file.
    But log file has been created with blank file. but shell sh script is not executed.
    I have given the full path of the shell sh file and given the full rights for the sh file.
    Is there any access permission to be set for sh file execution?
    Please help.Thank you in advance.

    OS: UNIX Solaries, Oracle Application Server 10g
    To run shell script from Oracle Forms, I used the following host('/bin/bash /u01/compile.sh') and it works well
    Now, I need to run unix command something like
    host('mv form1.fmx FORM1.FMX') but it's not working
    I tried to append the command mv form1.fmx FORM1.FMX' to the compile.sh shell script but also it's not working although the rest lines of the shell script is running well

  • Patches with pre and or post patch scripts not executable -- why?

    In my frustration with update manager hangs I have had to kill processes and restart and even manually unjar files and patchadd. Sometimes I run across the error that the pre or post patch scripts are not executable. I have in the past chmod 744 and patchadd then applies the patch. This has happened several times in my latest patch update. I also had a patch ( X11) that implied a lack of entitlement but the manual patchadd showed that the real problem was a missing prerequisite patch.
    My questions are:
    1. is this lack of executable permission on scripts ( pre and post) by design and am I missing the correct procedure?
    2. missing prerequisite scripts? why?
    3. out of frustration --- IS THIS PATCHING UTILITY THE BEST THAT SUN CAN DO?

    Update Manager is sometimes a little flaky, particularly on unpatched systems (as it uses many different utilities). I would suggest that if you are having problems then you should use smpatch instead - it's not really any more difficult to use and is often much quicker.
    If a patch has a script that is not executable that is not a fault of updatemanager, but a fault with the patch itself (being archived with incorrect settings) or possibly your umask setting, which should ideally be globaly set to 0022 prior to patching to prevent problems during extraction and application.
    If updatemanager has complained about a lack of entitlement I would tend to believe that this was the case, check the contents of your entitlement file:
    # cat /var/sadm/spool/cache/entitlement/*entitlement_clientYou may be missing SolarisAllUpdates or other entitlements - please post the output.
    Sun do offer other patching tools, but what is best for one person/company may not be the best for all. There is also the possibility that you don't have it setup correctly - I would ask that you run the attached script and upload the output file generated to our [Support Uploads|http://supportuploads.sun.com/] site.

  • Runtime.getRuntime().exec problem with linux script.

    Hello,
    I try to start a script under Linux RedHat 9. This script must just create another file.
    I work with JDK 1.4.1_02b06.
    If I use the next command
    process = Runtime.getRuntime().exec("/temp/myScript.sh");
    This is not working. I script file is existing otherwise I receive an error. I don't understand why the script is not executed!
    I have check some other posts in this forum but I cannot find the solution.
    Thanks in advance for your help.
    Alain.

    Try running it with sh: Runtime.getRuntime().exec("sh /temp/myScript.sh");

  • Global Conditions - Powershell Script - Script is not signed (Error: 87D00327; Source: CCM)

    I failed to use any Powershell script in Global Conditions with error 87D00327. The script is signed and tested without problem. Setting execution policy doesn't change the result at all.
    Error message as below:
    In-line script returned error output: File C:\Windows\CCM\SystemTemp\e7001c04-3966-46a7-9622-26c36d9c45de.ps1 cannot
    be loaded. The file C:\Windows\CCM\SystemTemp\e7001c04-3966-46a7-9622-26c36d9c4
    5de.ps1 is not digitally signed. The script will not execute on the system. Ple
    ase see "get-help about_signing" for more details..
    At line:1 char:2
    + & <<<< 'C:\Windows\CCM\SystemTemp\e7001c04-3966-46a7-9622-26c36d9c45de.ps1'
    + CategoryInfo : NotSpecified: (:) [], PSSecurityException
    + FullyQualifiedErrorId : RuntimeException
    ScriptProvider 6/23/2014 1:45:06 PM 2516 (0x09D4)
    ScriptProvider::CreateInstanceEnumAsync - Script Execution Returned :1, Error Message:File C:\Windows\CCM\SystemTemp\e7001c04-3966-46a7-9622-26c36d9c45de.ps1 cannot
    be loaded. The file C:\Windows\CCM\SystemTemp\e7001c04-3966-46a7-9622-26c36d9c4
    5de.ps1 is not digitally signed. The script will not execute on the system. Ple
    ase see "get-help about_signing" for more details..
    At line:1 char:2
    + & <<<< 'C:\Windows\CCM\SystemTemp\e7001c04-3966-46a7-9622-26c36d9c45de.ps1'
    + CategoryInfo : NotSpecified: (:) [], PSSecurityException
    + FullyQualifiedErrorId : RuntimeException
    ScriptProvider 6/23/2014 1:45:06 PM 2516 (0x09D4)
    Failed in discovering instance.
    Script is not signed (Error: 87D00327; Source: CCM) ScriptProvider 6/23/2014 1:45:06 PM 2516 (0x09D4)
    Failed to do HandleExecQueryAsync().
    Script is not signed (Error: 87D00327; Source: CCM) ScriptProvider 6/23/2014 1:45:06 PM 2516 (0x09D4)
    Failed to process CScriptProvider::GExecQueryAsync.
    Script is not signed (Error: 87D00327; Source: CCM) ScriptProvider 6/23/2014 1:45:06 PM 2516 (0x09D4)
    I can't figure out a way to capture the temp script file mentioned in the error message so I can't verify the script locally.
    Any help will be appreciated.
    Sean
    Regards, Sean

    Hi, Sean.
    There was a product issue with signed PowerShell detection method scripts that has been fixed in R2 CU2. I just noticed it's not mentioned in the KB article for CU2. I'm not sure what happened here but I'll have somebody look into this.
    Anyway, there's a couple of caveats to consider regarding this fix in your scenario. Firstly if you're creating a PowerShell script detection method you must not copy/paste the script text -- you need to "Open" it. Secondly, if you have any previously created
    PowerShell script detection methods with signed scripts, you will need to re-add the detection script (again using "Open"). Finally, you must use an administrator console that's been updated to CU2 and a client that's been updated to CU2 for this fix to be
    effective.
    I hope this helps resolve the issue for you.
    Check out my Configuration Manager blog at http://aka.ms/ameltzer

  • Script can not be invoked from a java stored procedure

    i made a java procedure and called it via a sql procedure which takes a string as input :
    the string is passed to Runtime.getRuntime().exec("myString");
    if that string is :
    rm -f /test/test22.log
    proc = Runtime.getRuntime().exec("rm -f /test/test22.log");
    the file test22.log which is in the test folder gets deleted
    but when i pass the command . /test/batchstart.ksh to execute a script the script does not execute.
    proc = Runtime.getRuntime().exec(". /test/batchstart.ksh");
    file permissions have been given and also the executable rights.
    if some bobdy can tell why the script is not executing that will be of great help

    i am Still facing the following problem:
    if i pass a parameter like :
    rm -f /test/menu.ksh
    then the required output is that the menu.ksh file gets deleted.
    but when i pass this command:
    ./test/menu.ksh
    It is supposed to execute the specified script but it does not.
    I have tried multiple things like giving chmod 777 rights to the following file and changing the command to /test/menu.ksh but nothing happens
    Can you kindly tell me what can the problem be. Is there any execution rights issue: i am executing these scripts from pl sql developer.
    You can find both the procedure and java method which is being called below
    ==========================================================================================
    create or replace procedure TEST_DISPLAY(filename in varchar2, result out varchar2, error out varchar2) is
    command varchar2(100);
    vRetChar varchar2(100);
    begin
    command := filename ;
    prc_host(command, vRetChar);
    result := vRetChar;
    dbms_output.put_line(result);
    Exception
    when No_Data_Found Then
    error := 'Command is not Found';
    dbms_output.put_line('Failure');
    return;
    end TEST_DISPLAY;
    ======================================================================
    create or replace and compile java source named host as
    import java.io.*;
    import java.lang.Runtime;
    import java.lang.Process;
    import java.io.IOException;
    import java.lang.InterruptedException;
    public class Host {
    public static void executeCommand(String command,String[] outString) {
    String RetVal;
    try {
    String[] finalCommand;
    final Process pr = Runtime.getRuntime().exec(command);
    // Capture output from STDERR...
    }

  • Shtml/servlet not executing in defaultFilename

    Has anyone encountered the case where a servlet tag (<servlet
    name=snoop>
    </servlet>) doe not execute inside a defaultFilename of index.shtml?
    Servlet Doesn't Execute
    If the the request URL is of the form http://www.domain.com, it does not
    work.
    Servlet Does Execute
    It does work if the full URL is used http://www.domain.com/index.shtml
    When it does not work, the default page is still getting served.
    However, the servlet has not executed and the servlet tags are still
    inside the html (see below). TIA.
    John Hogan
    Meetu.Com
    p.s. (index.shtml has been set as the defaultFilename in
    weblogic.properties)
    weblogic.httpd.initArgs.file=defaultFilename=index.shtml
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <html>
    <head>
    <title>Testing</title>
    </head>
    <body>
    <servlet name=snoop>
    </servlet>
    </body>
    </html>
    [att1.html]

    I came up with a solution, but your options are something to consider, and probably more efficient too. Thank you for that.
    This might not be the best solution, but I left the include of the servlet in the jsp page, passed the request parameter to the servlet, servlet calls db, checks value, if no results, servlet sets a request attribute, retrieve attribute within the jsp, direct the page using a redirect in the jsp.
    Servlet example -
       //get request parameter
      String snr = request.getParameter("snr");
      //call database, query table
      if(!rs.next()) { //value not found
        request.setAttribute("valid","no");
      } else {
        //continue executing servlet methods
    //.... JSP example -
    //include servlet, pass request parameter "snr"
    //get request attribute, check value
    String valid = (String)request.getParameter("valid");
    if(valid.equals("no")) {
       response.sendRedirect("PageNotFound.jsp");
    } else {
      //continue processing page
    //...This works, but maybe I should look into ways (as you suggested) to improve it. In answer to your question, yes, the request parameter is always required. I will need to look into ServletFilter to learn more about that.
    Thank you for the reply and expertise.

Maybe you are looking for

  • Error while installing a patch for Mainwin 5.0.2 on Solaris 2.8

    Hi, I am relatively new in this field, so i apologise for any slip-ups. We use a Solaris 2.8-SPARC server. I was given an external drive which contained the porting software Visual Mainwin 5.0.2 and was told to install it from the drive. On checking

  • Is there a way to perform a clean install without the Internet on the computer that my iPhone is backed up on?

    I don't have Internet on my PC that my iPhone is backed up to. Without connecting it to the Internet, how can I perform a clean install? Since iOS 7 my battery life has been crap, I've tried everything except a clean install, so this is my last resor

  • Wrt600n / wpc600n random disconnect issues

    hi, i've been running the new AP / cards for a few weeks now, and am seeing some weird behavior on them. when connected to the AP using either vista (using windows to manage wireless setting), or in xp (using the linksys utility), i'm getting random

  • Error in B1 DB Profiler

    Error in B1 DB Profiler: Even though I configured my SBO_SP_Transaction Notification stored Procedure, I am getting the Error like below.      "An addon test has been run.Several lines should appear in the B1DbProfiler is not correctly configured.If

  • Edited photos not updating on AppleTV

    I have a problem with photos that I have edited on iphoto08 not updating on my apple TV. The original un-edited photo remains! Any ideas? Thanks Glenn