Here's my problem - I'm trying to write a small wrapper script that adds a command line argument when Xorg is called (I don't have access to the caller's source.) It seemed simple enough, but the problem I'm now running into is that the caller is waiting for a USR1
signal from Xorg. From the XSERVER man page:
SIGUSR1
This signal is used quite differently from either of the above. When the server starts, it checks to see if it has inherited SIGUSR1 as SIG_IGN instead of the usual SIG_DFL. In this case, the server sends a SIGUSR1 to its parent process after it has set up the various connection schemes. Xdm uses this feature to recognize when connecting to the server is possible.
I thought I could simply trap the signal and forward it:
#!/bin/bash
parent_trap(){
echo sending USR1 to $PPID &> /tmp/wrapper.log
kill -USR1 $PPID
}
trap "parent_trap" USR1
Xorg $@ (extra stuff) &
wait
But of course this doesn't work, as the script itself is started by the caller ignoring USR1
. I THINK what I need to do is have the script stop ignoring the signal, but also somehow launch Xorg with USR1
ignored (to trigger the behavior from the man page.)
Is this possible in Bash/some other scripting language? For a few reasons I'm hoping to avoid a compiled solution, but it's not unthinkable. It's also possible I'm completely thinking about this wrong and there's some other way to get USR1
from Xorg to the caller.