Linux下运行Java

 

>>运行指定了MainClass的jar包:

#!/bin/sh
. /apps/cron_env

cd /apps/wlscron/rds_jboss_us

java   -Drds_jnp=fca-vm-rds-prod1:1100,fca-vm-rds-prod2:1100,fca-vm-rds-prod3:1100 -jar RDSCron.jar

META-INF/MANIFEST.MF:

Manifest-Version: 1.0
Ant-Version: Apache Ant 1.7.1
Created-By: 1.5.0_14 (Sun Microsystems Inc.)
Main-Class: com.synnex.rds.engine.Startup
Class-Path: ./lib/mail.jar ./lib/jbossall-client.jar ./lib/activation.
 jar

 

>>运行未指定MainClass的jar包:

#!/bin/sh
. /apps/cron_env

cd /apps/wlscron/rds_retire_ca

java -Drds_jnp=ton-vm-rds-dev.aaa.org:1100 -classpath biz-rds.jar:jbossall-client.jar com.aaa.biz2.rds.cron.retire.Startup

 注意:这里-classpath的分隔符是:':',而在Windows下使用的是:';'。

 

>>复杂用法:

#!/usr/bin/ksh
. /etc/SYBASE.sh
. /apps/cron_env 

SHARE_LIB=/apps/shared/lib
APP_HOME=$APP_ROOT/cronfit/projects/timecardcron
APP_LOG=$LOG_ROOT/cronfit/projects/timecardcron1.log
maillist=`cat $APP_HOME/timecardcron_mail`

echo "*******************************************************************************************" > $APP_LOG

echo "[`date '+%H:%M:%S'`] TimeCard email cron to notify all employee to submit timesheets starting ..." >> $APP_LOG

echo "*******************************************************************************************" >> $APP_LOG

DB_USER=$CRONFIT_DWS_LOGIN
DB_PWD=$CRONFIT_DWS_PASSWD
DB_URL=$CRONFIT_DWS_URL
#DB_DEBUG=10/22/09
CLASSPATH=$APP_HOME/timecardcron.jar:$SHARE_LIB/mail.jar:$SHARE_LIB/synnex.jar:$SHARE_LIB/activation.jar:$SHARE_LIB/jconn2.jar:$CLASSPATH

echo $CLASSPATH

cd $APP_HOME

java -Ddb.driverclass=com.sybase.jdbc2.jdbc.SybDriver -Dcorp.user=$DB_USER -Dcorp.password=$DB_PWD -Dcorp.url=$DB_URL com.synnex.cis.timecardcron.TimeCardNotification >> $APP_LOG

echo "*******************************************************************************************" >> $APP_LOG

echo "[`date '+%H:%M:%S'`] TimeCard email cron to notify all employee to submit timesheets ending ..." >> $APP_LOG

echo "*******************************************************************************************" >> $APP_LOG

/usr/bin/mailx -r "$CRON_MAIL_FROM" -s "TimeCard email cron to notify all employee to submit timesheets(CA)" "$maillist" < $APP_LOG

 

>>

>>

你可能感兴趣的:(linux)