I use this command to run my work.
(time bash executeScript 1 input fileOutput $> scrOutput) &> timeUse.txt
While, 1 is a number of process that I use to run this work. I have to change the number of process for each run. At each time it use long time to complete. Then I want to run it as background process.
How can I do it?
I tried:
nohup ((time bash executeScript 1 input fileOutput $> scrOutput) &> timeUse.txt)
But it doesn't work.
You can write a script and then use
nohup ./yourscript &
to executeFor example:
put
you may also need to change permission to run script on server
finally
In general, I use
nohup CMD &
to run a nohup background process. However, when the command is in a form thatnohup
won't accept then I run it throughbash -c "..."
.For example:
stdout from the script gets written to
script.out
, while stderr and the output oftime
goes intotime_n_err.out
.So, in your case:
Use screen: Start
screen
, start your script, press Ctrl+A, D. Reattach withscreen -r
.Make a script that takes your "1" as a parameter, run
nohup yourscript
: