I'm trying to make a little java job that copies files from one folder to another and some database storage and such. The job runs from a script which is executed once each hour. I'd like to have a little check in the java job which can return some value if the job is already running.
Problem is, I have NO idea how to do this. Any suggestions?
Each hour the job is run like the following: "java myjob arg1 arg2". Is it even possible to check if the job that was started 1 hour ago is still running?
EDIT
Just thought of something.. Since each time this job is run it gets a new process id the suggestions below wont work. My job will be run from another script like this:
if ${type} = ${sys}
then
java batchjob ${type} ${dir1} ${dir2}