-1

I have written a script in which I am executing some other .ksh script.

When I run the script standalone its working fine however if I run the script through crontab its not working properly.

Could anyone please help me to do this?

#!/bin/ksh

DIVIDER="---------------------------------------------------------------\
-----------------" # 80 chars, DO NOT CHANGE THIS!

alias net='plutoneadmin.ksh all all -R queueEsm -l 2> /dev/null'
DATA=`net | awk 'BEGIN { FS="|" } /^I/ { print $2 "-" $3 "-" $4 "-" $5 }'`
printf "%-20s%-15s%-15s%-15s%-15s\n" "Network Element" "Instance Num" "Current Req." "Maximum Req." "Status"
echo $DIVIDER
for ne in $DATA; do
name=`echo $ne | awk 'BEGIN { FS="-" } { print $1 }'`
num=`echo $ne | awk 'BEGIN { FS="-" } { print $2 }'`
cur=`echo $ne | awk 'BEGIN { FS="-" } { print $3 }'`
max=`echo $ne | awk 'BEGIN { FS="-" } { print $4 }'`
sts=`echo $ne | awk 'BEGIN { FS="-" } { print $5 }'`

status="NOT CONNECTED"
if [ "$sts" = "FREE" ]; then status="CONNECTED"; fi
if [ "$sts" = "USED" ]; then status="CONNECTED"; fi

printf "%-20s%-15s%-15s%-15s%-15s\n" $name $num $cur $max "$status"
done
echo

and crontab entry is 
49,06 07,14,16 * * * /plutone/VDSCRIPT/tstnt.sh
  • Please edit your question to include your crontab entries and the script you are trying to run ... otherwise we will just be guessing answers ... and read How do I ask a good question?. – DavidPostill Jun 17 '15 at 13:39
  • script and crontab entry is posted in question. – Sachin Jun 17 '15 at 13:58
  • Yes, but it is completely unreadable. Please format it in such a way that it is possible to read the file without effort. The effort should go into solving problem, but who will be willing to put in such effort, if you do not even care to make your post legible? – MariusMatutiae Jun 17 '15 at 14:08
  • I am new to this forum so couldnt aware about it, I will make it in readable format... apology for in convience. – Sachin Jun 17 '15 at 15:48
0

These things are almost always path or environment related. Just from a quick look I see potential trouble with the calling of plutoneadmin.ksh.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.