sleep 60 | awk '{print 1}'
(Don't consider why I sleep and pipe. The point here is pipe)
I put nohup in front of it but SIGHUP disposition is still default
(checked with /usr/proc/bin/psig on Solaris) and indeed closing the
terminal window kills the process. Tried enclosing that line with ""
or (). Got syntax error. Thanks for help.
Yong Huang
There's always this:
nohup $SHELL << EOF
sleep 60 | awk '{print 1}'
EOF
--
Søren Hansen Linuxkonsulent I/S
Open source specialist http://www.linuxkonsulent.dk
s...@linuxkonsulent.dk
Thanks. I appened & to your second line and that works.
I thought my real work could be replaced by that sleep 60 | awk line.
I was wrong. What I really want is this:
tail -f httpds_access_log | nawk '{if($0~/Some Error/) system("echo
Check Apache | mailx -s CheckApache yon...@yahoo.com")}' &
[It's one line; nawk doesn't allow line break] This checks new lines
appended to Apache access log and emails me when "Some Error" is
found. It runs fine like this. But it doesn't email me when it's
wrapped between nohup $SHELL <<EOF and EOF. Any idea?
Yong Huang
I guess there's no better way. So I put that tail -f | nawk line in a
script and nohup thatscript. It works. I wish nohup was rewritten to
support command sequences.
Yong Huang
nohup is rewritten, and it is called "submit".
"submit" can do all nohup can do, plus something that nohup can not do.
For example, you can use "submit" to do what you want to do:
submit "command1 | command2"
Unfortunately it is not a native command, but you can get it from
URL below and put it in your PATH. [Posted and Emailed].
--
Michael Wang
http://www.unixlabplus.com/
Thanks, Michael. That's pretty impressive. It'll be very useful if the
submitted job needs some sophisticated control.
BTW, I find that nohup somecommand | nohup othercommands also works
for me. So I'm doing this now:
nohup tail -f access_log | nohup nawk '/SomeString/ {system("mailx -s
ChkIt yon...@yahoo.com < /dev/null")}' &
In order to suppress "Sending output to nohup.out", I run it in csh.
Yong Huang
>BTW, I find that nohup somecommand | nohup othercommands also works
perhaps you want:
nohup sh -c "command1 | command2"
--
bringing you boring signatures for 17 years