I have a very simple script, let's call it foo.sh. It's this:

sxhkd &
panel &

where panel is a script (I won't post it here because it's very long and I don't think it would be relevant) which will spawn some child processes.
I execute the script with sh foo.sh.
Now, my problem is that if I kill panel from another shell with pkill panel for some reason sxhkd is also killed, and that is very undesiderable. I tried ampersand, disown, nohup, and I haven't got other ideas.

How can I avoid that?

1 Answer 1


untested, but try

nohup sxhkd </dev/null >/dev/null 2>/dev/null &
nohup panel </dev/null >/dev/null 2>/dev/null &

To completely disassociate them from each other

  • Tried now, it still doesn't work.
    – pinusc
    Feb 7, 2016 at 15:19
  • Check that panel doesn't have any traps that might kill the other process Feb 7, 2016 at 15:28
  • Oh, damn. thank you, that was it! Panel had a trap I didn't notice.
    – pinusc
    Feb 7, 2016 at 15:42
  • What did the trap look like? I have the exact same problem running panel and sxhkd. (I copied somebody's panel a long while back and modified it heavily) Jun 14, 2016 at 22:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.