SCRIPT IN SAP


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting SCRIPT IN SAP
# 1  
Old 02-22-2010
SCRIPT IN SAP

Hi all,
I have written one script. it is working fine. But when I am going to run this script through SAP in sm37 job it is giving error.
Code:
Ext. prog.: Can't exec external program (Exec format error)
Ext. prog.: External program terminated with exit code 1
Ext. prog.: SAPXPG started on cpcsaps2_RS2_35, Process ID 22001, Process Number 12
External program was cancelled
Job cancelled
#!/bin/ksh
print '================================================'>> log_core
delcnt=0
delcnt_old=0

for files in `find ./ -name core_test -mtime -5 -type f -print`

do

echo " $files Deleted : " `date +%Y-%m-%d.%Hh%Mm%Ss`\n >> log_core
delcnt=$(($delcnt + 1))
/bin/rm $files
done
for oldfiles in `find /usr/sap/RS2/DVEBMGS35 -name core_test_old -mtime -5 -type
f -print`
do
echo " $oldfiles moved to : /usr/sap/RS2/core_old \n">>log_core
delcnt_old=$(($delcnt_old + 1))
/usr/bin/mv $oldfiles /usr/sap/RS2/core_old
done
echo "deleted $delcnt files">> log_core
echo "$delcnt_old files moved ">> log_core
#this is for mail text
curmth=`date +%m`
set -A mth Dec Jan Feb March April May June July August Sept Oct Nov Dec
prevmth=${mth[$((curmth + 1))]}
season1='Hi,\n The two month old below files moved to the new location.'
season2='Kindly have a look on them.these files will be automaticaly deleted onw
1st'
#mail text end
echo "${season1} ${season2} $prevmth \n">>log_core
print '====================End==========================='>> log_core
if [[ $delcnt -ne 0 || $delcnt_old -ne 0 ]];
then
cat /usr/sap/RS2/email_list | while read emails
do
echo $emails
mailx -r alert -s "Core Deletion" $emails<log_core && mailq
echo Mail Sent Successfully
done
fi
rm log_core


Last edited by Scott; 02-22-2010 at 05:28 PM.. Reason: Removed formatting, added code tags
Login or Register to Ask a Question

Previous Thread | Next Thread

7 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Can't execute unix script from SAP BO DI

Dear all, I am very new to UNIX but and need some help in order to make BO DI Job Server execute a .sh script. My unix script has set permissions as under: -rwxrwxrwx. What I m trying to do is move a .txt file from one directory to another on UNIX server. I have full access to Feed... (7 Replies)
Discussion started by: sapbibodi
7 Replies

2. UNIX for Dummies Questions & Answers

UNIX commands fr SAP

Hi Has anyone worked in SAP/Netweaver. Im looking for some basic unix commands for SUN servers. Unix commands like check if the java server is running or not..etc please help thanks -m77 (1 Reply)
Discussion started by: m77
1 Replies

3. HP-UX

How to Extend SAP dir

Hi bros, i'm new HP-UX user actually we use SAP over unix some problems faced me when the log files in SAP directory full then i need sample way to extend folder size for SAP logs or to make it auto extend Thanks (1 Reply)
Discussion started by: bakkar
1 Replies

4. UNIX for Advanced & Expert Users

SAP swap recommendations

Hello all. My company is installing an SAP ERP financials. The consultants are asking me to allocate 30Gbytes of swap. This is on a dedicated Linux box running Redhat 5 64Bit OS. It has 16GB of RAM.I have asked for an explanation but all I'm getting is that this is what SAP recommends. It seems... (2 Replies)
Discussion started by: jhtrice
2 Replies

5. AIX

SAP and MIB

Hi there all.. I got SAP running on AIX systems. Now I got SNMP running and it is collecting info. But I want the SAP MIB to be running so I can also retrieve SAP info. How can I neable it on AIX? When I do a MIB walk on SAP it isnt showing anything. Thanx in advance! :) (1 Reply)
Discussion started by: draco
1 Replies

6. HP-UX

Transfer HP UX Database To SAP

I need more information to transfer my currently HP UX to SAP Database. Anyone can help ? (1 Reply)
Discussion started by: erichaise
1 Replies

7. AIX

AIX 5.3 Heap Memory with SAP

Any idea whether this parameter can be set / adjusted and where please? (3 Replies)
Discussion started by: johnf
3 Replies
Login or Register to Ask a Question