Part of the Shell script is not running via crontab, runs fine manually

Hello Team,

 As a part of my job we have made a script to automate a service to restart frequently. 
      Script having two functions when executing it's should find the existing service and kill it, then start the same service . Verified the script it's working fine when executing manually. 

 But when keeping it in cron, It's finding the existing service and killing the same but not starting the service. Please help me out of this.
weblogic@[/home/weblogic]# crontab -l
34 19 * * * /SWIG/utilities/ATM_Restart_New.sh  2>/dev/null

weblogic@SWIG/utilities]# cat ATM_Restart_New.sh
#!/usr/bin/env ksh
. ~/.profile
# Use the following script to kill the currently running instance
# of the ATM scheduler, and restart the scheduler in nohup mode.
#Identify SWIG PID

PID=$(ps -ef | grep SWIG | grep -v "grep" | awk {'print $2'});
#print "Original ATM process using PID=$PID"
# Kill the ATM
kill -9 $PID

sleep 30


/usr/bin/nohup /flexcube/user_projects/domains/WBFCSIM2/deployed_apps/SWIG/utilities/run.sh 2>&1 > nohup.out &

weblogic@[/SWIG/utilities]#

Running manually :

weblogic@appsrv2dr[/SWIG/utilities]# ps -ef | grep -i swig | grep -v grep
weblogic 11075760        1   0 19:38:04  pts/0  0:00 /bin/sh /flexcube/user_projects/domains/WBFCSIM2/deployed_apps/SWIG/utilities/run.sh
weblogic 12386330 11075760   0 19:38:04  pts/0  0:02 /usr/java6_64/bin/java -cp ./:/flexcube/user_projects/domains/WBFCSIM2/deployed_apps/                                       SWIG/build/SWIG.jar:./:/flexcube/user_projects/domains/WBFCSIM2/deployed_apps/SWIG/lib/GW_EJB_Bean.jar:./:/flexcube/user_projects/domains/                                       WBFCSIM2/deployed_apps/SWIG/lib/j2ee.jar:./:/flexcube/user_projects/domains/WBFCSIM2/deployed_apps/SWIG/lib/xercesImpl.jar:./:/flexcube/us                                       er_projects/domains/WBFCSIM2/deployed_apps/SWIG/lib/xalan.jar:./:/flexcube/user_projects/domains/WBFCSIM2/deployed_apps/SWIG/lib/wlfullcli                                       ent.jar::/oracle/app/Middleware1032/wlserver_10.3/server/lib/weblogic.jar:/flexcube/user_projects/domains/WBFCSIM2/deployed_apps/SWIG/lib/                                       GW_EJB_Bean.jar com.iflex.sw.server.SWManagerInitializer ../config/

weblogic@[//SWIG/utilities]# sh -x ./ATM_Restart_New.sh
+ . /home/weblogic/.profile
+ hostname -s
+ export HOST=appsrv2dr
+ export PS1=weblogic@appsrv2dr[$PWD]#
+ export EDITOR=/usr/bin/vi
+ export ENV=/home/weblogic/.kshrc
+ TMOUT=0
+ TIMEOUT=0
+ export readonly TMOUT TIMEOUT
+ PATH=/usr/bin:/etc:/usr/sbin:/usr/ucb:/home/weblogic/bin:/usr/bin/X11:/sbin:.
+ PATH=/usr/bin:/etc:/usr/sbin:/usr/ucb:/home/weblogic/bin:/usr/bin/X11:/sbin:.:/usr/java6_64/bin:/oracle/app/Middleware1032/Oracle_WT1/op                                       mn/bin:
+ export PATH
+ HISTSIZE=500
+ HISTFILE=/var/log/hist/hist_weblogic.12058854
+ export HISTSIZE HISTFILE
+ export DISPLAY=localhost:1.0
+ export ORACLE_INSTANCE=/oracle/app/Middleware1032/Oracle_WT1/instances/wbohs
+ [ -s /usr/spool/mail/weblogic ]
+ + ps -ef
+ grep SWIG
+ grep -v grep
+ awk {print $2}
PID=11075760
12386330
+ kill -9 11075760 12386330
+ sleep 30


+ /usr/bin/nohup /flexcube/user_projects/domains/WBFCSIM2/deployed_apps/SWIG/utilities/run.sh
+ 2>& 1 1> nohup.out
weblogic@[SWIG/utilities]#

try:

PID=$(ps -ef | grep SWIG | grep -v -E "grep|$0" | awk {'print $2'});

Hello Rdrtx1,

Made the mentioned change. But still when it's running via the corn job it's running fine until killing the process but it's not starting the service.

FYI : It's working perfectly when runs manually.

Thanks,
Gowtham.G

try:

 
PID=$(ps -ef | grep SWIG | grep -v "grep" | grep -v "ATM_Restart_New.sh" | awk {'print $2'});
 

Be sure that your script can find all the utilities it needs in the PATH. Cron often has a far more minimal PATH than your login shell.

Here's a trick to avoid grep -v grep:

grep 'WIG'

But actually, since you're using awk, you don't need anything else in there.

ps -ef | awk '/WIG/ && !/ATM_Restart_New[.]sh/ { print $2 }'

Hello Rdrtx1,

As per your advice I've made the changes, still no luck.
weblogic@[/SWIG/utilities]# ps -ef | grep SWIG
weblogic 11927598        1   0 20:29:15  pts/0  0:00 /bin/sh /flexcube/user_projects/domains/WBFCSIM2/deployed_apps/SWIG/utilities/run.sh
weblogic 12058744 11927598   0 20:29:15  pts/0  0:01 /usr/java6_64/bin/java -cp ./:/flexcube/user_projects/domains/WBFCSIM2/deployed_apps/SWIG/build/SWIG.jar:./:/flexcube/user_projects/domains/WBFCSIM2/deployed_apps/SWIG/lib/GW_EJB_Bean.jar:./:/flexcube/user_projects/domains/WBFCSIM2/deployed_apps/SWIG/lib/j2ee.jar:./:/flexcube/user_projects/domains/WBFCSIM2/deployed_apps/SWIG/lib/xercesImpl.jar:./:/flexcube/user_projects/domains/WBFCSIM2/deployed_apps/SWIG/lib/xalan.jar:./:/flexcube/user_projects/domains/WBFCSIM2/deployed_apps/SWIG/lib/wlfullclient.jar::/oracle/app/Middleware1032/wlserver_10.3/server/lib/weblogic.jar:/flexcube/user_projects/domains/WBFCSIM2/deployed_apps/SWIG/lib/GW_EJB_Bean.jar com.iflex.sw.server.SWManagerInitializer ../config/

weblogic@[/SWIG/utilities]# ps -ef | grep run.sh
weblogic 11927598        1   0 20:29:15  pts/0  0:00 /bin/sh /flexcube/user_projects/domains/WBFCSIM2/deployed_apps/SWIG/utilities/run.sh
weblogic@[/SWIG/utilities]# date
Thu Oct  4 20:32:57 GMT+03:00 2012
weblogic@[/SWIG/utilities]# crontab -l
34 20 * * * /flexcube/user_projects/domains/WBFCSIM2/deployed_apps/SWIG/utilities/ATM_Restart_New.sh  2>/dev/null
weblogic@[/SWIG/utilities]#
weblogic@[/SWIG/utilities]# date
Thu Oct  4 20:35:35 GMT+03:00 2012
weblogic@[/SWIG/utilities]# ps -ef | grep SWIG
weblogic@[/SWIG/utilities]# ps -ef | grep run.sh
weblogic@[/SWIG/utilities]#

weblogic@[/SWIG/utilities]# cat ATM_Restart_New.sh
#!/usr/bin/env ksh
. ~/.profile
# Use the following script to kill the currently running instance
# of the ATM scheduler, and restart the scheduler in nohup mode.
#Identify SWIG PID

PID=$(ps -ef | grep SWIG | grep -v -E "grep|ATM_Restart_New.sh" | awk {'print $2'});
#print "Original ATM process using PID=$PID"
# Kill the ATM
kill -9 $PID

sleep 30
echo $date

/usr/bin/nohup /flexcube/user_projects/domains/WBFCSIM2/deployed_apps/SWIG/utilities/run.sh 2>&1 > nohup.out &

weblogic@[/SWIG/utilities]#

maybe:

 
PID=$(ps -ef | grep SWIG | grep -v -E "grep|ATM_Restart_New.sh" | awk -v pid=$$ '$2 != pid {print $2}');

Hello Corona688,

I've tried whatever you suggested but no luck.
weblogic@[/SWIG/utilities]# date
Thu Oct  4 20:48:01 GMT+03:00 2012
weblogic@[/SWIG/utilities]# crontab -l
49 20 * * * /flexcube/user_projects/domains/WBFCSIM2/deployed_apps/SWIG/utilities/ATM_Restart_New.sh  2>/dev/null
weblogic@[/SWIG/utilities]# cat ATM_Restart_New.sh
#!/usr/bin/env ksh
. ~/.profile
# Use the following script to kill the currently running instance
# of the ATM scheduler, and restart the scheduler in nohup mode.
#Identify SWIG PID

PID=$(ps -ef |awk '/WIG/ && !/ATM_Restart_New[.]sh/ { print $2 }');
#print "Original ATM process using PID=$PID"
# Kill the ATM
kill -9 $PID

sleep 30
echo $date

/usr/bin/nohup /flexcube/user_projects/domains/WBFCSIM2/deployed_apps/SWIG/utilities/run.sh 2>&1 > nohup.out &

weblogic@[/SWIG/utilities]# date
Thu Oct  4 20:53:22 GMT+03:00 2012
weblogic@[/SWIG/utilities]# ps -ef | grep SWIG
weblogic@[/SWIG/utilities]#

Have you tried:

?

Hello Rdrtx1,

Yes I've tried your advice, please check the output's below.
weblogic@[/flexcube/user_projects/domains/WBFCSIM2/deployed_apps/SWIG/utilities]# crontab -l
49 20 * * * /flexcube/user_projects/domains/WBFCSIM2/deployed_apps/SWIG/utilities/ATM_Restart_New.sh  2>/dev/null
weblogic@a[/flexcube/user_projects/domains/WBFCSIM2/deployed_apps/SWIG/utilities]# date
Thu Oct  4 20:59:50 GMT+03:00 2012
weblogic@[/flexcube/user_projects/domains/WBFCSIM2/deployed_apps/SWIG/utilities]# crontab -e
weblogic@[/SWIG/utilities]#  crontab -l
01 21 * * * /flexcube/user_projects/domains/WBFCSIM2/deployed_apps/SWIG/utilities/ATM_Restart_New.sh  2>/dev/null
weblogic@[/SWIG/utilities]# grep PID ATM_Restart_New.sh
#Identify SWIG PID
PID=$(ps -ef | grep SWIG | grep -v -E "grep|ATM_Restart_New.sh" | awk  -v pid=$$ '$2 != pid {print $2'});
#print "Original ATM process using PID=$PID"
kill -9 $PID
weblogic@[/SWIG/utilities]# ps -ef | grep SWIG
weblogic 11075824 12058628   0 20:55:50  pts/0  0:01 /usr/java6_64/bin/java -cp ./:/flexcube/user_projects/domains/WBFCSIM2/deployed_apps/SWIG/build/SWIG.jar:./:/flexcube/user_projects/domains/WBFCSIM2/deployed_apps/SWIG/lib/GW_EJB_Bean.jar:./:/flexcube/user_projects/domains/WBFCSIM2/deployed_apps/SWIG/lib/j2ee.jar:./:/flexcube/user_projects/domains/WBFCSIM2/deployed_apps/SWIG/lib/xercesImpl.jar:./:/flexcube/user_projects/domains/WBFCSIM2/deployed_apps/SWIG/lib/xalan.jar:./:/flexcube/user_projects/domains/WBFCSIM2/deployed_apps/SWIG/lib/wlfullclient.jar::/oracle/app/Middleware1032/wlserver_10.3/server/lib/weblogic.jar:/flexcube/user_projects/domains/WBFCSIM2/deployed_apps/SWIG/lib/GW_EJB_Bean.jar com.iflex.sw.server.SWManagerInitializer ../config/
weblogic 12058628 10354770   0 20:55:50  pts/0  0:00 /bin/sh /flexcube/user_projects/domains/WBFCSIM2/deployed_apps/SWIG/utilities/run.sh
weblogic@[/SWIG/utilities]# date
Thu Oct  4 21:02:20 GMT+03:00 2012
[1] + Killed                   /usr/bin/nohup /flexcube/user_projects/domains/WBFCSIM2/deployed_apps/SWIG/utilities/run.sh 2>&1 > nohup.out &
weblogic@[/SWIG/utilities]# ps -ef | grep SWIG
weblogic@[//SWIG/utilities]# ps -ef | grep SWIG
weblogic@[/SWIG/utilities]#

---------- Post updated at 11:42 PM ---------- Previous update was at 11:37 PM ----------

Running Manually .

weblogic@[/flexcube/user_projects/domains/WBFCSIM2/deployed_apps/SWIG/utilities]# sh -x ATM_Restart_New.sh
+ . /home/weblogic/.profile
+ hostname -s
+ export HOST=appsrv2dr
+ export PS1=weblogic@appsrv2dr[$PWD]#
+ export EDITOR=/usr/bin/vi
+ export ENV=/home/weblogic/.kshrc
+ TMOUT=0
+ TIMEOUT=0
+ export readonly TMOUT TIMEOUT
+ PATH=/usr/bin:/etc:/usr/sbin:/usr/ucb:/home/weblogic/bin:/usr/bin/X11:/sbin:.
+ PATH=/usr/bin:/etc:/usr/sbin:/usr/ucb:/home/weblogic/bin:/usr/bin/X11:/sbin:.:/usr/java6_64/bin:/oracle/app/Middleware1032/Oracle_WT1/opmn/bin:
+ export PATH
+ HISTSIZE=500
+ HISTFILE=/var/log/hist/hist_weblogic.12058662
+ export HISTSIZE HISTFILE
+ export DISPLAY=localhost:1.0
+ export ORACLE_INSTANCE=/oracle/app/Middleware1032/Oracle_WT1/instances/wbohs
+ [ -s /usr/spool/mail/weblogic ]
+ echo [YOU HAVE NEW MAIL]
[YOU HAVE NEW MAIL]
+ + ps -ef
+ grep SWIG
+ grep -v -E grep|ATM_Restart_New.sh
+ awk -v pid=12058662 $2 != pid {print $2}
PID=11075638
11141320
+ kill -9 11075638 11141320
+ sleep 30
+ echo

+ /usr/bin/nohup /flexcube/user_projects/domains/WBFCSIM2/deployed_apps/SWIG/utilities/run.sh
+ 2>& 1 [1] + Killed                   /usr/bin/nohup /flexcube/user_projects/domains/WBFCSIM2/deployed_apps/SWIG/utilities/run.sh 2>&1 > nohup.out &
weblogic@appsrv2dr[/flexcube/user_projects/domains/WBFCSIM2/deployed_apps/SWIG/utilities]# 1> nohup.out

weblogic@[/flexcube/user_projects/domains/WBFCSIM2/deployed_apps/SWIG/utilities]# ps -ef | grep SWIG
weblogic 11141326 12189830   0 21:10:09  pts/0  0:01 /usr/java6_64/bin/java -cp ./:/flexcube/user_projects/domains/WBFCSIM2/deployed_apps/SWIG/build/SWIG.jar:./:/flexcube/user_projects/domains/WBFCSIM2/deployed_apps/SWIG/lib/GW_EJB_Bean.jar:./:/flexcube/user_projects/domains/WBFCSIM2/deployed_apps/SWIG/lib/j2ee.jar:./:/flexcube/user_projects/domains/WBFCSIM2/deployed_apps/SWIG/lib/xercesImpl.jar:./:/flexcube/user_projects/domains/WBFCSIM2/deployed_apps/SWIG/lib/xalan.jar:./:/flexcube/user_projects/domains/WBFCSIM2/deployed_apps/SWIG/lib/wlfullclient.jar::/oracle/app/Middleware1032/wlserver_10.3/server/lib/weblogic.jar:/flexcube/user_projects/domains/WBFCSIM2/deployed_apps/SWIG/lib/GW_EJB_Bean.jar com.iflex.sw.server.SWManagerInitializer ../config/
weblogic 11468850 10354770   0 21:10:28  pts/0  0:00 grep SWIG
weblogic 12189830        1   0 21:10:09  pts/0  0:00 /bin/sh /flexcube/user_projects/domains/WBFCSIM2/deployed_apps/SWIG/utilities/run.sh
weblogic@[/flexcube/user_projects/domains/WBFCSIM2/deployed_apps/SWIG/utilities]#

quite possible that 'run.sh' needs a controlling terminal. You're starting it with 'nohup' - that might be an issue. Loose the 'nohup' and try.
Also, it might be that 'run.sh' needs some environment variables that you're not setting in the '~/.profile', but rather somewhere else...
Modify your script to:

nohup /flexcube/user_projects/domains/WBFCSIM2/deployed_apps/SWIG/utilities/run.sh 2>&1 > ~/run.out &

and examine the ~/run.out and see what's there.

Hello Vgersh99,

Run.sh having the environment details. Please check the below output.

FYI : run.out doesn't having any output.

weblogic@[/flexcube/user_projects/domains/WBFCSIM2/deployed_apps/SWIG/utilities]# tail ATM_Restart_New.sh

PID=$(ps -ef | grep SWIG | grep -v -E "grep|ATM_Restart_New.sh" | awk  -v pid=$$ '$2 != pid {print $2'});
#print "Original ATM process using PID=$PID"
# Kill the ATM
kill -9 $PID

sleep 30
echo $date

/usr/bin/nohup /flexcube/user_projects/domains/WBFCSIM2/deployed_apps/SWIG/utilities/run.sh 2>&1 > ~/run.out &
weblogic@r[/flexcube/user_projects/domains/WBFCSIM2/deployed_apps/SWIG/utilities]# date
Thu Oct  4 21:20:11 GMT+03:00 2012
weblogic@[/flexcube/user_projects/domains/WBFCSIM2/deployed_apps/SWIG/utilities]# crontab -l
21 21 * * * /flexcube/user_projects/domains/WBFCSIM2/deployed_apps/SWIG/utilities/ATM_Restart_New.sh  2>/dev/null
weblogic@appsrv2dr[/flexcube/user_projects/domains/WBFCSIM2/deployed_apps/SWIG/utilities]# ps -ef | grep SWIG | grep -v grep
weblogic 11141326 12189830   0 21:10:09  pts/0  0:02 /usr/java6_64/bin/java -cp ./:/flexcube/user_projects/domains/WBFCSIM2/deployed_apps/SWIG/build/SWIG.jar:./:/flexcube/user_projects/domains/WBFCSIM2/deployed_apps/SWIG/lib/GW_EJB_Bean.jar:./:/flexcube/user_projects/domains/WBFCSIM2/deployed_apps/SWIG/lib/j2ee.jar:./:/flexcube/user_projects/domains/WBFCSIM2/deployed_apps/SWIG/lib/xercesImpl.jar:./:/flexcube/user_projects/domains/WBFCSIM2/deployed_apps/SWIG/lib/xalan.jar:./:/flexcube/user_projects/domains/WBFCSIM2/deployed_apps/SWIG/lib/wlfullclient.jar::/oracle/app/Middleware1032/wlserver_10.3/server/lib/weblogic.jar:/flexcube/user_projects/domains/WBFCSIM2/deployed_apps/SWIG/lib/GW_EJB_Bean.jar com.iflex.sw.server.SWManagerInitializer ../config/
weblogic 12189830        1   0 21:10:09  pts/0  0:00 /bin/sh /flexcube/user_projects/domains/WBFCSIM2/deployed_apps/SWIG/utilities/run.sh
weblogic@appsrv2dr[/flexcube/user_projects/domains/WBFCSIM2/deployed_apps/SWIG/utilities]# cat /flexcube/user_projects/domains/WBFCSIM2/deployed_apps/SWIG/utilities/run.sh
#!/bin/sh

export APP_SERVER_NAME=WEBLOGIC
export APP_SERVER_LIB=/oracle/app/Middleware1032/wlserver_10.3/server/lib
export GW_CALL=EJB
export PROJECT_DIR=/flexcube/user_projects/domains/WBFCSIM2/deployed_apps/SWIG
export JAVA_HOME=/usr/java6_64
export PATH=$JAVA_HOME/bin:$PATH:
CLASSPATH=./:$PROJECT_DIR/build/SWIG.jar:./:$PROJECT_DIR/lib/GW_EJB_Bean.jar:./:$PROJECT_DIR/lib/j2ee.jar:./:$PROJECT_DIR/lib/xercesImpl.jar:./:$PROJECT_DIR/lib/xalan.jar:./:$PROJECT_DIR/lib/wlfullclient.jar:

CLASSPATH=$CLASSPATH:$APP_SERVER_LIB/weblogic.jar
export CLASSPATH

$JAVA_HOME/bin/java -cp $CLASSPATH:$PROJECT_DIR/lib/GW_EJB_Bean.jar com.iflex.sw.server.SWManagerInitializer ../config/
weblogic@appsrv2dr[/flexcube/user_projects/domains/WBFCSIM2/deployed_apps/SWIG/utilities]# date
Thu Oct  4 21:21:41 GMT+03:00 2012
weblogic@[/flexcube/user_projects/domains/WBFCSIM2/deployed_apps/SWIG/utilities]# ps -ef | grep SWIG
weblogic@[/home/weblogic]# ls -l run.out
-rw-r--r--    1 weblogic winstall          0 Oct 04 21:21 run.out
weblogic@appsrv2dr[/home/weblogic]# 

I noticed your 'CLASSPATH' has './' in several places. When you run the 'run.sh' manually, do you always run it from your HOME dir? If you run it from ANY dir, will the run.sh still do what it's supposed to do?

Once again, it might be the case that 'run.sh' expects a controlling terminal and having 'nohup' and running it from cron might be an issue - I don't know.
Try loosing the 'nohup' in the script and running the modified script from cron - see what happens.

Removed the nohub still no luck. I've tried to run the run.sh from /tmp directory the script not working seems.

weblogic@r[/home/weblogic]# cd /tmp
weblogic@[/tmp]#  /flexcube/user_projects/domains/WBFCSIM2/deployed_apps/SWIG/utilities/run.sh 2>&1 > ~/run.out &
[1]     12189808
weblogic@[/tmp]# java.io.FileNotFoundException: ../config/switch.properties (A file or directory in the path name does not exist.)
        at java.io.FileInputStream.open(Native Method)
        at java.io.FileInputStream.<init>(FileInputStream.java:123)
        at com.iflex.sw.common.SWConfig.initializeProperties(SWConfig.java:63)
        at com.iflex.sw.server.SWManagerInitializer.main(SWManagerInitializer.java:78)

[1] +  Done                     /flexcube/user_projects/domains/WBFCSIM2/deployed_apps/SWIG/utilities/run.sh 2>&1 > ~/run.out &
weblogic@[/tmp]#

weblogic@[/tmp]# ps -ef | grep SWIG

ok, then - change all './' in the CLASSPATH to '$HOME' and run script from /tmp - see if it works. If it does, try it from cron.

As per your advise modified the classpath still no luck. Please have a look below.

weblogic@[/home/weblogic]# cd /tmp
weblogic@[/tmp]# nohup /flexcube/user_projects/domains/WBFCSIM2/deployed_apps/SWIG/utilities/run.sh 2>&1 > nohup.out &
[1]     11927680
weblogic@[/tmp]#
[1] +  Done                    nohup /flexcube/user_projects/domains/WBFCSIM2/deployed_apps/SWIG/utilities/run.sh 2>&1 > nohup.out &
weblogic@[/tmp]#
weblogic@[/tmp]# ps -ef | grep run.sh
weblogic 11075678 10354770   0 22:07:36  pts/0  0:00 grep run.sh
weblogic@appsrv2dr[/tmp]# ps -ef | grep SWIG

weblogic@[/tmp]# cat /flexcube/user_projects/domains/WBFCSIM2/deployed_apps/SWIG/utilities/run.sh
#!/bin/sh

export APP_SERVER_NAME=WEBLOGIC
export APP_SERVER_LIB=/oracle/app/Middleware1032/wlserver_10.3/server/lib
export GW_CALL=EJB
export PROJECT_DIR=/flexcube/user_projects/domains/WBFCSIM2/deployed_apps/SWIG
export JAVA_HOME=/usr/java6_64
export PATH=$JAVA_HOME/bin:$PATH:
CLASSPATH=$HOME:$PROJECT_DIR/build/SWIG.jar:$HOME:$PROJECT_DIR/lib/GW_EJB_Bean.jar:$HOME:$PROJECT_DIR/lib/j2ee.jar:$HOME:$PROJECT_DIR/lib/xercesImpl.jar:$HOME:$PROJECT_DIR/lib/xalan.jar:$HOME:$PROJECT_DIR/lib/wlfullclient.jar:

CLASSPATH=$CLASSPATH:$APP_SERVER_LIB/weblogic.jar
export CLASSPATH

$JAVA_HOME/bin/java -cp $CLASSPATH:$PROJECT_DIR/lib/GW_EJB_Bean.jar com.iflex.sw.server.SWManagerInitializer ../config/
weblogic@[/tmp]# ps -ef | grep SWIG

ok, now it works from /tmp - whereas it didn't before the change.
But it doesn't work from cron?
If that's the case - the problem now is with the cron.
Change your cron entry to:

34 19 * * * /SWIG/utilities/ATM_Restart_New.sh  2>~/cron.out

and examine ~/cron.out after the cron execution....

Vgersh,

It's not working from /tmp.. please check the above output again.

then you have a bigger issue - your script only works from $HOME and not from any other directory.
You need to debug this first...
Sorry, I cannot help you with that...

1 Like