I try to get a bash script running that should output the java process information to a file. Unfortunately when I add it to the crontab -e
the script is not executed.
As user root
the script is located in /root/bin
#!/bin/bash
PATH=/bin
DATE=`date +%Y-%m-%d" "%H:%M`
PROCESSINFO=`ps aux | grep java | grep -v grep`
echo "$DATE $PROCESSINFO" >> java.log
This is the crontab -e
configuration
* * * * * /root/jobs/log-crush-ftp-process.sh
* * * * * printf "test\n"
The printf "test\n"
is just a test, but since the output will only go in the mail there is no result on the screen. What am I missing?
Also I have another question about Java processes. Since everything is running in a runtime enviroment, is there a command where I can get more detailed information about the processes inside the JVM?
EDIT:
I deleted the last line printf...
and now I get mails for the script. But still no output in the java.log
.
This was a really bad issue by myself. If I did
mail
and looked the first mail with1
then I saw the messageI thought the whole time the error means the first column
/bin/sh
, but the real issue was that I renamed thejobs
folder tobin
. After changing the cronjob to(*/1 for every minute) the script is now executed.