Tiny Core Linux
Tiny Core Extensions => TCE Q&A Forum => Topic started by: Misalf on June 28, 2016, 10:38:29 AM
-
Hi there!
I'm searching for an one-liner to restart X, that I can then, for example, add to my Window Manager menu or execute via key press.
I was hoping for something like this to work
nohup { kill $(cat /tmp/.X${DISPLAY:1:1}-lock) ; sleep 2 ; startx ; }
I tried several combinations using {} , () , sh -c "" and & , but couldn't yet get it to work, since either the command dies together with X or X won't die at all.
Anyone has an idea?
-
Hi Misalf
Instead of a one liner maybe break the problem down into two pieces. Create a script with the required commands
called restartX. Place it in ~/.local/bin so it's included by the $PATH environmental variable. Your one liner will now
be restartX.
-
A while true loop in .profile and Ctrl-Alt-Bksp to kill X won't work?
-
Thanks Rich, I'll see if that can fit my needs. The reason I'm asking for a one-liner though, is that I would like it to be as portable as possible - user (and maybe distro) independent.
andyj, thanks but no (see above). Also, if I get it right, this would prevent the user from using the Linux console.
-
Yeah, of course. Just when I think i can't get it working...
{ kill $(cat /tmp/.X${DISPLAY:1:1}-lock) ; sleep 2 >/dev/tty0 ; startx >/dev/tty0 ; } &
Is /dev/tty0 always available?
-
This might be better
{ kill $(cat /tmp/.X${DISPLAY:1:1}-lock) && { sleep 1 ; startx ; } >/dev/tty0 ; } &