Home > OS >  Script execution twice, once can be performed, the second is executed is not completely
Script execution twice, once can be performed, the second is executed is not completely

Time:09-16

#!/bin/sh

NAME=gatewayServer
Echo $NAME
ID=` ps - ef | grep "$NAME" | grep -v "$0" | grep -v "grep" | awk '{print $2}' `
Echo $ID
Echo "-- -- -- -- -- -- -- -- -- -- -- -- -- -- --"
For id in $id
Do
Kill 9 $id
Echo $id "killed"
The done
Echo "-- -- -- -- -- -- -- -- -- -- -- -- -- -- --"

The DATE=` DATE + % Y % m % d `
LOGFILENAME=/eip/gateway/log/serverlogs paygateServer/startweblogic paygateServer. $DATE. Log
Rm - fr/weblogic/Oracle/Middleware/user_projects/domains/ebank_domain/servers/paygateServer/TMP/_WL_user
Export JAVA_OPTIONS="- Dfile. Encoding=utf-8 - Djava. Awt. The headless=true"
Export USER_MEM_ARGS="- d64 - Xms1024m - Xmx2048m - XX: XX: PermSize=256 m - MaxPermSize==512 m - Dtag gatewayTag"

Nohup/weblogic/Oracle/Middleware/user_projects/domains/ebank_domain/bin/startManagedWebLogic. Sh gatewayServer> $2 LOGFILENAME & gt; & 1 & amp;

Tail -f $LOGFILENAME



Results:
Normal for the first time, can kill the process, and restart, execute to the tail -f $LOGFILENAME, log flush to restart completed
Kill process, the second time, will also be able to restart the success, but can't perform tail -f $LOGFILENAME, log not refresh

CodePudding user response:

I want to write a resume script

CodePudding user response:

Add a log print to see? This is not a good visibility

CodePudding user response:

Try log backups,

CodePudding user response:

Appears to be file relative path error, lead to some variable didn't read it,

CodePudding user response:

- bash - 4.1 $
Means you have a problem the user configuration file
Under the skel hidden files copied to the user's home directory, and then try under test, not sure whether the reason for this
  • Related