AIX

 View Only

 Unable to Zip file through shell script

Venu Sivaraman's profile image
Venu Sivaraman posted 08/11/26 02:24 AM
I have HMC scanner report running in root's cron which zip the excel file send in mail. After Installing latest AIX e-fixes, zip operation through the cron script is not working. However it is executed if i run zip manually. 
 
Error:
exec(): 0509-036 Cannot load program zip because of the following errors:
        0509-130 Symbol resolution failed for zip because:
        0509-136   Symbol _GLOBAL__AIXI_libbz2_so (number 87) is not exported from
                   dependent module /usr/lib/libbz2.a(libbz2.so.1).
        0509-136   Symbol _GLOBAL__AIXD_libbz2_so (number 88) is not exported from
                   dependent module /usr/lib/libbz2.a(libbz2.so.1).
        0509-192 Examine .loader section symbols with the
                 'dump -Tv' command.
 
server1:root:[/home/root]:# ls -l /usr/lib/libbz2.a
lrwxrwxrwx    1 root     system           25 Aug 06 05:29 /usr/lib/libbz2.a -> /usr/opt/rpm/lib/libbz2.a
server1:root:[/home/root]:# ls -l libbz2.so*
ls: 0653-341 The file libbz2.so* does not exist.
server1:root:[/home/root]:#
Alexander Pettitt's profile image
Alexander Pettitt

# lslpp -w /usr/lib/libbz2.a
  File                                        Fileset               Type
  ----------------------------------------------------------------------------
  /usr/lib/libbz2.a                           rpm.rte               Symlink

# ls -l /usr/lib/libbz2.a
lrwxrwxrwx    1 root     system           25 Jul 28 07:58 /usr/lib/libbz2.a -> /usr/opt/rpm/lib/libbz2.a

Ayappan P's profile image
Ayappan P

Can you try adding "-Djava.library.path=/opt/freeware/lib:/usr/lib" in the java command inside the script ? 

Venu Sivaraman's profile image
Venu Sivaraman
cat /exploit/hmc_0.11.55/hmcScanner.ksh
#!/bin/ksh
 
# Update the PATH variable to locate java executable
#  Minimum java version is 1.8
PATH=/usr/java8_64/bin:/usr/java8_64/jre/bin:/usr/java8/bin:/usr/java8/jre/bin:$PATH
 
# Set BASE to hmcScanner file location
BASE=$(dirname $0)
 
# Check that java is in the path
type java > /dev/null 2>&1
if [[ $? -ne 0 ]]
then
        echo "java is not in the path"
        exit 1
fi
 
# Start java version check
java -cp $BASE Test
if [[ $? -ne 0 ]]
then
        echo "java must be version 1.8 or higher"
        exit 1
fi
# End java version check
 
# Run the scanner
java -Xmx1024m -Duser.language=en -Djava.util.logging.config.file=$BASE/hmcScanner.properties -cp $BASE/bcprov-jdk15on-1.69.jar:$BASE/jsch-0.1.67.jar:$BASE/hmcScanner.jar:$BASE/jxl.jar hmcScanner.Loader $*


This is the scannar script, which line i should the entry? 

Strange is when i execute the command zip it works. Not working through the shell script. I have also tried to put separate script to compress (zip) the file and mail command in another script that is also not working, throwing same error. 

#!/bin/ksh
RECIPIENT=`tr "\012" "\054" < /exploit/hmcscanner/script/pagelist`
F=`grep "Starting Excel file creation" /tmp/weekly_HMC_scan.log |head -1|awk -F ": " '{print $2}'`
zip $F.zip $F
sleep 10
uuencode $F.zip $F.zip | mail -vs " HMC scan report" $RECIPIENT



Ayappan P's profile image
Ayappan P

you can add "-Djava.library.path=/opt/freeware/lib:/usr/lib" entry in the below line in the scanner script and try again. 

# Run the scanner
java -Xmx1024m -Duser.language=en -Djava.util.logging.config.file=$BASE/hmcScanner.properties -cp $BASE/bcprov-jdk15on-1.69.jar:$BASE/jsch-0.1.67.jar:$BASE/hmcScanner.jar:$BASE/jxl.jar hmcScanner.Loader $*