Currently we are using PPM 9.14.0002.
We dont have any monitoring for PPM.
So I want to set a cronjob for running the kStatus.sh script (which gives the status of the application server -"running"/"not running" ).
I used the following command:
crontab -e0 4,8,12,16,20,24 * * * cd /..(path)../ppm/bin && sh kStatus.sh
The mail goes to the spool and this script gives the following error:
"ERROR: JAVA_HOME environment variable is not set :-(.Please set JAVA_HOME environment variable and try again. "
But the JAVA_HOME variable is already set.
Can anyone plaease let me know what I need to do to run the cronjob successfully?
Thanks in advance.
>Can anyone let me know what I need to do to run the cronjob successfully?
What OS version are you running? This is related to the OS more than PPM.
>But the JAVA_HOME variable is already set.
Why do you think it is set? If you don't set it in your crontab entry or in kStatus.sh, it won't be set.
crontab bypasses settings made in your ~/.profile.
Try by using the setting temporary variable for JAVA_HOME like set JAVA_HOME=xxxxx.
and excute the same script.
>I have tried setting the JAVA_HOME in kStatus.sh
Have you exported it?
Hard code JAVA_HOME variablie in kvariable.sh file.
For me it is working like this.
>export JAVA_HOME=/path/to/java; [Rest of command goes here]
Or you can just do:
JAVA_HOME=/path/to/java [Rest of command goes here]>I've had to do this type of thing many times in the past because cron does not load the .profile.
Or you can source your .profile:
. ~/.profile; [Rest of command goes here]