Return value if job is running
<p>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. </p>

<p>Problem is, I have NO idea how to do this. Any suggestions?</p>

<p>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?</p>

<p><strong>EDIT</strong></p>

<p>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:</p>

<pre><code>if ${type} = ${sys}
    then 
        java batchjob ${type} ${dir1} ${dir2}
</code></pre>
