Skip to content

Instantly share code, notes, and snippets.

@TrevorS
Created September 19, 2014 18:54
Show Gist options
  • Save TrevorS/0e18035f2bb10f51dc1b to your computer and use it in GitHub Desktop.
Save TrevorS/0e18035f2bb10f51dc1b to your computer and use it in GitHub Desktop.
#!/bin/bash
today=`date +%Y%m%d`
#source /etc/profile
cd /home/automation/UlineUserImport
if [ "$1" == "" ]
then
echo ""
echo "Usage: run [program]"
echo "Example: ./run uline-import -cfg import.conf"
echo ""
exit
fi
if [ -e lock ]
then
echo "lock file exists. Exiting..."
exit
fi
if [ -e /home/automation/UlineUserImport/test.txt ]
then
mv /home/automation/UlineUserImport/test.txt processed
cp processed/test.txt test.txt
chown fkocadag:onpoint test.txt
else
echo "Could not find input file for today"
fi
if [ -e test.txt ]
then
touch lock
# the JARS variable defines the various jar files
# required by the application.
LDIR=/home/tomcat/lib;
JARS=$JAVA_HOME/jre/lib/rt.jar:/home/tomcat/lib/oplsdb-4.0.jar:/home/tomcat/lib/oplscommon-5.4.jar:/home/tomcat/lib/oplsdata-5.4.jar:/root/oplsutils/lib/mail/mail.jar:/home/tomcat/lib/activation.jar:/home/tomcat/lib/commons-codec-1.3.jar
JARS="$JARS:`ls $LDIR/mysql*jar`:`ls $LDIR/log4j*jar`"
echo "$JAVA_HOME/bin/java -jar $1 -cp $JARS $2 $3 $4 $5 $6"
$JAVA_HOME/bin/java -jar $1 -cp $JARS $2 $3 $4 $5 $6 > Import.log
rm test.txt
mv Import.log logs/Import.$today.log
rm lock
else
echo "Missing input file test.txt"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment