bash - Why do I end up with two processes? -
i wrote script has been running daemon quite time now. if ever needed debug it, stop daemon version , rerun manually in current shell. have never logged out of script, getting ready deploy on remote server figured want log errors script into. purpose followed hints several postings , doing following:
if ! tty > /dev/null; exec > >(/bin/logger -p syslog.warning -t mytag -i) 2>&1 fi this seems log fine, surprised see 2 instances of script listed ps when feature enabled. there way avoid it?
i know process logger , assume has >(...), still hope avoid it
bash spawns subshell execute command(s) in >( ... ). in case, thing subshell run /bin/logger, it's rather pointless. think can "fix" exec command:
if ! tty > /dev/null; exec > >(exec /bin/logger -p syslog.warning -t mytag -i) 2>&1 fi this doesn't prevent subshell starting, instead of running /bin/logger subprocess (of subshell), subshell gets replaced /bin/logger. haven't tested logger, worked fine in quick test did cat , seemed work fine.
Comments
Post a Comment