Quantcast
Viewing latest article 2
Browse Latest Browse All 5

Answer by Thomas for How to start and kill the procedure?

Use something like

#!/bin/bashjava -jar <name-of-the-jar-file> &javapid=$!sleep <some-time-in-seconds>kill $javapid

in a file, make it executable (chmod +x ) and run it using

./<filename>

This will start the jar-file and kill it after some time. There are several ways to excecute the command at regular intervals. You could use cron ( http://help.ubuntu.com/community/CronHowto ) to always excecut it as long the computer is runnig. Or use a simple shell script loop to start the execution from the command line:

#!/bin/bash COUNTER=0while [  $COUNTER -lt 100 ]; do<same as above without the first line>     let COUNTER=COUNTER+1 done

This will run the command 100 times, you could stop the execution simply by pressing ctrl-c.


Viewing latest article 2
Browse Latest Browse All 5

Trending Articles