You are not logged in.
This is my script (it's part of something larger, but is enough for now):
#!/bin/sh
setsid test_run.shWhat I'm trying to do is to create a proc that runs by itself and deals with its own input/output and doesn't bother my shell or the script from which it is started. I thought about using nohup, but would prefer to never see the nohup.out file.
When I run the above, I see the output of the running proc displayed and the command line from where I started this becomes unusable.
Last edited by publicus (2014-09-10 15:04:22)
Offline
in zsh, disown -<job>
Bash is probably the same.
Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way
Offline
setsid sounds like what you want, you just need to redirect the standard streams. Depending on what it is you are "disowning" one might not commonly tamper with stdin, but you could do that to. Just for stdout/stderr you'd do `setsid your_command >/dev/null 2>&1 &`
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
setsid sounds like what you want, you just need to redirect the standard streams. Depending on what it is you are "disowning" one might not commonly tamper with stdin, but you could do that to. Just for stdout/stderr you'd do `setsid your_command >/dev/null 2>&1 &`
This worked very well. Thank you.
Offline
For a really agressive form, I use the following bash function:
hush() {
(setsid $@ >/dev/null 2>&1) >/dev/null 2>&1
}This costs an extra subshell, but it also silences the setsid messages about the process number and the exit code when the process completes.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline