# CRONTAB to run python script in HANA appliance

**URL:** <https://forums.suse.com/t/crontab-to-run-python-script-in-hana-appliance/28363>\
**Category:** SLES SAP Applications\
**Created:** [June 30, 2016, 12:26am UTC](https://forums.suse.com/t/crontab-to-run-python-script-in-hana-appliance/28363 "2016-06-30T00:26:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![parthashazra](https://avatars.discourse-cdn.com/v4/letter/p/5daacb/32.png) [@parthashazra](https://forums.suse.com/u/parthashazra)\
**Post date:** [June 30, 2016, 12:26am UTC](https://forums.suse.com/t/crontab-to-run-python-script-in-hana-appliance/28363/1 "2016-06-30T00:26:44Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![smflood](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/smflood/32/10576_2.png) [@smflood](https://forums.suse.com/u/smflood)\
**Post date:** [June 30, 2016, 12:47am UTC](https://forums.suse.com/t/crontab-to-run-python-script-in-hana-appliance/28363/2 "2016-06-30T00:47:44Z")

</div>

parthashazra Wrote in message:  
[color=blue]

> 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?[/color]

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/](http://usenet.sinaapp.com/)

---

<div class="post-metadata">

**Author:** ![Jens-U](https://avatars.discourse-cdn.com/v4/letter/j/d78d45/32.png) [@Jens-U](https://forums.suse.com/u/Jens-U)\
**Post date:** [July 5, 2016, 7:44pm UTC](https://forums.suse.com/t/crontab-to-run-python-script-in-hana-appliance/28363/3 "2016-07-05T19:44:16Z")

</div>

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
