Tiny Core Extensions > TCE Q&A Forum
One-Liner to restart X?
Misalf:
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
--- Code: ---nohup { kill $(cat /tmp/.X${DISPLAY:1:1}-lock) ; sleep 2 ; startx ; }
--- End code ---
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?
Rich:
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.
andyj:
A while true loop in .profile and Ctrl-Alt-Bksp to kill X won't work?
Misalf:
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.
Misalf:
Yeah, of course. Just when I think i can't get it working...
--- Code: ---{ kill $(cat /tmp/.X${DISPLAY:1:1}-lock) ; sleep 2 >/dev/tty0 ; startx >/dev/tty0 ; } &
--- End code ---
Is /dev/tty0 always available?
Navigation
[0] Message Index
[#] Next page
Go to full version