Cron Job not running
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 3 of 3

Thread: Cron Job not running

Hybrid View

  1. #1
    Join Date
    Mar 2006
    Location
    Charlotte, NC
    Posts
    865

    Cron Job not running

    Hi Friends:

    I have an weired situation here. I have written a small script to query number of sessions comming in from app servers to my database as well as to display the sar 5 5 report.

    Here is my script.

    connections.sql
    Code:
    select username, COUNT(*), status, machine
    from v$session
    where username is not null
    and machine in ('xxxxxx','xxxxxx','xxxxxx')
    and username ='xxxxxx'
    GROUP BY USERNAME, status, machine
    order by username asc, count(*) desc
    /
    spool off
    !echo `sar 5 5 >> ics_connections.log`
    !echo `cat ics_connections.log|mailx -s "SESSIONS and CPU" vijay.x.tummala@xxxxx.com`
    exit
    connections.sh
    Code:
    #!/usr/bin/ksh
    . ~/.profile
    
    sqlplus '/as sysdba' << EOF
    @connections.sql
    when i run connections.sh manually, it is executing fine and emailing me the below output.

    HTML Code:
    USERNAME                         COUNT(*) STATUS   MACHINE
    ------------------------------ ---------- -------- -------------------------
    XXXXX                                         1668        INACTIVE xxxxxxxx
    XXXXX                                         1548        INACTIVE xxxxxxxx
    XXXXX                                         1370        INACTIVE xxxxxxxx
    XXXXX                                            14        ACTIVE   xxxxxxxx
    XXXXX                                              8        ACTIVE   xxxxxxxx
    XXXXX                                              2        ACTIVE   xxxxxxxx
    
    SunOS xxxxxx 5.10 Generic_125100-05 sun4u    12/15/2007
    
    21:05:35    %usr    %sys    %wio   %idle
    21:05:41      15       9       0      75
    21:05:47      15       8       0      77
    21:05:53      15       8       0      77
    21:05:59      14       7       0      79
    21:06:05      14       7       0      79
    
    Average       15       8       0      77
    when i schedule the same thru crontab it is not working. Here is my cron entry.

    Code:
    Cron entry
    15,30,45,00 * * * * /home/oracle/scripts/connections.sh > /dev/null 2>&1
    Please help me to identify where i am going wrong.

    Thank you,
    Vijay Tummala

    Try hard to get what you like OR you will be forced to like what you get.

  2. #2
    Join Date
    Mar 2006
    Location
    Charlotte, NC
    Posts
    865
    I missed a line in my sql script. I am spooling the output to a file ics_connections.log

    Thank you,
    Vijay Tummala

    Try hard to get what you like OR you will be forced to like what you get.

  3. #3
    Join Date
    Sep 2002
    Location
    England
    Posts
    7,333
    you need to set oracle home and sid as cron won't read your profile

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width