I have the java code as the following:
public class Example{
public static void main(String args[]){
//Done something here
// Start process A
somefunction();
}
public static void somefunction(){
// Done some implementation
System.out.println("Completed");
}
}
I have a process A (a linux script) that runs for about 20 minutes. This process doesn't effect my current program in any way.
The following I am trying to do: 1. Trigger to run the process. 2. I dont want to wait for that process to complete. 3. Immediately start with somefunction() after triggering of the process.
I just want to trigger/run the process A and don't care if any output it gives when it gets completed.
I have looked the following link : Run a external application in java but don't wait for it to finish
but was not able to run the process, successfully.
I tried to run some shorter command like : "sleep 10; mv /home/file /home/file1;", for "name" argument in the above link. (Command description: This command just sleep for 10 seconds and the rename file to file1. I did not happen. (FYI, I am using RedHat).)
The code runs successfully but I can't see any rename of the file after 10 seconds.
How do I do it? Some sample code will be really helpful.
Thanks.