The switch monitoring deployed yesterday had no clue at first, because it was the first time to get these things. Later, the mentor taught me how to do it !!
The first step is to write the script setenv for setting environment variables. sh. This script is required to load all jar packages and startup items. class file, you can directly import the jar package you want to import using export, but note that the specified path should be complete, such:
ExportApphome=/APP/BASD/ibnms/netinf
ExportJarpath= $ Apphome/libs
Export Path =/APP/BASD/ibnms/j2sdk1.4.2 _ 12/bin: $ path
ExportOtherclasspath= $ Otherclasspath: $JarpathBackport-util-concurrent.jar
In this way, the jar package is imported!
The following is the import. Class file:
Export classpath = $ apphome/bin: $Apphome/Classes: $Otherclasspath
This file ends. The following is the start. Sh file, which is the startup script:
../Setenv. Sh
Pro_key = "netinterface"
Echo *** starting *** $ {pro_key}
Pro_count = 'ps-Ef | grep $ {pro_key} | grep-V grep | WC-l'
If [$ pro_count-LT 1]
Then
Nohup Java-d $ {pro_key} com. sitech. Manage. collinitinport> ../log/call. log &
Nohup Java-d $ {pro_key} com. sitech. Manage. schedulerconfig "0 40 17 **? ">>../Log/call. log &
Nohup Java-d $ {pro_key} com. sitech. Manage. schedulerinterfacestatus "0, 31,46 ***? ">>../Log/call. log &
Echo "***** started ***** $ {pro_key}, logs in ../log dir"
Else
Echo "****** fail *****: there is already $ {pro_count}" process with key/"$ {pro_key}/" exists
Fi
Note:
The first step is to set the environment variable, using setenv. sh file, and then use the command line to check whether the process exists. If yes, It is not started. If no, It is started. In the startup script, use nohup Java-d $ {pro_key} COM. sitech. manage. start the method in the form of collinitinport and output the startup information to the log file. This is the end, and it is worth noting that it is the path problem;
Similarly, stop. Sh can also be written as follows:
PS-Ef | grep netinterface | grep-V grep | awk '{print $2}' | while read line
Do
Echo $ line kill
Kill-9 $ line
Done
Find the process and delete it with the process number ~