Results 1 to 3 of 3

Thread: CRONTAB to run python script in HANA appliance

Hybrid View

  1. #1

    CRONTAB to run python script in HANA appliance

    All Gurus

    I am just 1 year old in Linux handling and almost novice in shell scripting & crontab scheduling.

    I am trying to schedule some python script (standard python script come with HANA cdpy directory) using CRONTAB I have created shell script and that is running fine stand-alone.

    But when I try to schedule this via CRONTAB then it is running Actually it ignores that command and run everything else.

    Would you please review?

    Shell Script:


    r3eomdbp1020:/usr/sap/KHA/SYS/global/sapcontrol/snapshots> cat fullDUMP.sh
    #!/bin/bash
    #following command will create a full system info dump in /usr/sap/KHA/SYS/global/sapcontrol/snapshots
    #now=$(date +"%m_%d_%Y")
    /usr/sap/KHA/HDB01/exe/Python/bin/python /usr/sap/KHA/HDB01/exe/python_support/fullSystemInfoDump.py
    #>> /bkup/FILESYS/FSID_$now.log
    #following command will move above created full system info dump to /bkup/FILESYS/
    #echo
    #mv /usr/sap/KHA/SYS/global/sapcontrol/snapshots/fullsysteminfodump* /bkup/FILESYS/

    CRONTAB entry:

    r3eomdbp1020:/usr/sap/KHA/SYS/global/sapcontrol/snapshots> crontab -l
    # DO NOT EDIT THIS FILE - edit the master and reinstall.
    # (/tmp/crontab.XXXXElLiiy installed on Wed Jun 29 16:16:32 2016)
    # (Cron version V5.0 -- $Id: crontab.c,v 1.12 2004/01/23 18:56:42 vixie Exp $)
    #define env variable PATH for CRONTAB
    PATH=/sbin:/usr/sbin:/usr/local/sbin:/root/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/X11R6/bin:/usr/games:/usr/lib64/jvm/jre/bin:/usr/lib/mit/bin:/usr/lib/mit/sbin:/usr/sap/KHA/HDB01/r3eomdbp1020:/usr/sap/KHA/HDB01:/usr/sap/KHA/HDB01/exe:/usr/sap/KHA/HDB01/exe/Python/bin:/usr/sap/KHA/HDB01/exe/dat_bin_dir:.:/usr/sap/KHA/home:/usr/sap/KHA/home/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/X11R6/bin:/usr/games:/usr/lib64/jvm/jre/bin:/usr/lib/mit/bin:/usr/lib/mit/sbin
    #actual CRONTAB command
    18 * * * * /usr/sap/KHA/SYS/global/sapcontrol/snapshots/fullDUMP.sh

    Could you please guide me on this?

    Regards
    Partha

  2. #2

    Re:CRONTAB to run python script in HANA appliance

    parthashazra Wrote in message:

    > I am just 1 year old in Linux handling and almost novice in shell
    > scripting & crontab scheduling.
    >
    > I am trying to schedule some python script (standard python script come
    > with HANA cdpy directory) using CRONTAB ? I have created shell script
    > and that is running fine stand-alone.
    >
    > But when I try to schedule this via CRONTAB then it is running ?
    > Actually it ignores that command and run everything else.
    >
    > Would you please review?
    > _
    > SHELL_SCRIPT:_
    >
    > R3EOMDBP1020:/USR/SAP/KHA/SYS/GLOBAL/SAPCONTROL/SNAPSHOTS> CAT
    > FULLDUMP.SH
    > #!/bin/bash
    > #following command will create a full system info dump in
    > /usr/sap/KHA/SYS/global/sapcontrol/snapshots
    > #now=$(date +"%m_%d_%Y")
    > /usr/sap/KHA/HDB01/exe/Python/bin/python
    > /usr/sap/KHA/HDB01/exe/python_support/fullSystemInfoDump.py
    > #>> /bkup/FILESYS/FSID_$now.log
    > #following command will move above created full system info dump to
    > /bkup/FILESYS/
    > #echo
    > #mv /usr/sap/KHA/SYS/global/sapcontrol/snapshots/fullsysteminfodump*
    > /bkup/FILESYS/
    >
    > CRONTAB entry:
    >
    > R3EOMDBP1020:/USR/SAP/KHA/SYS/GLOBAL/SAPCONTROL/SNAPSHOTS> CRONTAB -L
    > # DO NOT EDIT THIS FILE - edit the master and reinstall.
    > # (/tmp/crontab.XXXXElLiiy installed on Wed Jun 29 16:16:32 2016)
    > # (Cron version V5.0 -- $Id: crontab.c,v 1.12 2004/01/23 18:56:42 vixie
    > Exp $)
    > #define env variable PATH for CRONTAB
    > PATH=/sbin:/usr/sbin:/usr/local/sbin:/root/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/X11R6/bin:/usr/games:/usr/lib64/jvm/jre/bin:/usr/lib/mit/bin:/usr/lib/mit/sbin:/usr/sap/KHA/HDB01/r3eomdbp1020:/usr/sap/KHA/HDB01:/usr/sap/KHA/HDB01/exe:/usr/sap/KHA/HDB01/exe/Python/bin:/usr/sap/KHA/HDB01/exe/dat_bin_dir:.:/usr/sap/KHA/home:/usr/sap/KHA/home/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/X11R6/bin:/usr/games:/usr/lib64/jvm/jre/bin:/usr/lib/mit/bin:/usr/lib/mit/sbin
    > #actual CRONTAB command
    > 18 * * * * /usr/sap/KHA/SYS/global/sapcontrol/snapshots/fullDUMP.sh
    >
    > Could you please guide me on this?


    With Linux the case used for file paths and names is important.
    From the above it's very hard to know whether the file path(s) or
    name contain upper and/or lower case characters.

    What you could do is add ">/tmp/cron.log 2 >&1" to the end of the
    fullDUMP.sh line in your crontab entry which will log any output
    from fullDUMP.sh to /tmp/cron.log. Going from the above I wonder
    if fullDUMP.sh is really named with that mix of case?

    HTH.
    --
    Simon Flood
    Micro Focus (Novell/NetIQ) Knowledge Partner


    ----Android NewsGroup Reader----
    http://usenet.sinaapp.com/

  3. Re: CRONTAB to run python script in HANA appliance

    Hi Partha,

    in addition to Simon's advice about logging the output of your script (as run by cron) to identify errors when invoking, please check that your script is actually an executable (perms 755 or alike).

    Regards,
    Jens
    From the times when today's "old school" was "new school"

    If you find this post helpful and are logged into the web interface, show your appreciation and click on the star below...

Bookmarks

Posting Permissions

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