|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
hi,
i want to write scripts such that the intermediate process that takes 3-4 hours for process should be in background and the fore ground should be carried. pls give reply ASAP |
|
#2
|
|||
|
|||
|
Ok, if I read you correctly what you are after is something like:
Code:
#!/usr/bin/sh #script.sh # # run some short-lived commands command1 command2 # run a long command and let it run in background long_command & # run some more short commands command3 command4 # now wait for the batch job to end wait # and exit script exit If you do not care about waiting for the end of the long running job you can omit the wait command. If you just want to 'fire and forge' the whole thing run via nohup: Code:
nohup script.sh & That will let the script survive your terminal session ending. |
![]() |
| Viewing: Dev Shed Forums > Operating Systems > UNIX Help > How to use background jobs in middle of shellscripts |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|