stumpwm-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to restart x11/StumpWM from a different tty.


From: Stefan Reichör
Subject: Re: How to restart x11/StumpWM from a different tty.
Date: Wed, 08 Apr 2020 16:36:25 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

Hi Lionel,

> You can set the DISPLAY environment variable to connect to X from any
> terminal. In bash/zsh this should do the trick:
>
> export DISPLAY=:0
>
> Then your commands will work.
>
> I have a dirty trick to handle WM crashes: instead of starting the
> stumpwm binary directly I use a shell script that does something
> like:
>
> while [ ! -f /tmp/stopstump ]
> do
>      stumpwm
>      sleep 1
> done
>
> This way if stumpwm crashes or freeze and I have have to kill it it's
> restarted automatically without killing my X session and running
> programs. If I really want to quit the WM and end the session I have
> to "touch /tmp/stopstump" first.
>
> A bit ugly, but it served me well.
>
> --
> Lionel Flandrin

That is a really nice idea. I was already using some tmux sessions that 
survived a stumpwm crash.
I remembered a tool that will do the restart of a crashed application: 
daemontools

 - http://cr.yp.to/daemontools.html
 - daemontools is a collection of tools for managing UNIX services.
 - supervise monitors a service. It starts the service and restarts the service 
if it dies. Setting up a new service is easy: all supervise needs is a 
directory with a run script that runs the service.

# apt-get install daemontools

Now I use daemontools to restart stumpwm when it crashes. Perhaps this
is useful for somebody else as well:


Content of ~/supervise/stumpwm/run
<example>
#!/bin/sh
/home/stefan/prg/bin/stumpwm
</example>

* Run stumpwm through supervise
 # supervise /home/stefan/supervise/stumpwm
 # svstat ~/supervise/stumpwm
/home/stefan/supervise/stumpwm: up (pid 32536) 238 seconds
 - Restart stumpwm
   # killall stumpwm
     - 'svc -k ~/supervise/stumpwm' does not work since it only kills the 
script.
       Not sure why - perhaps because the script is restarted and exits since 
the window manager is already running
 - Quit stumpwm to get back to the login manager (-x ... tell supervise to stop 
when stumpwm exits, -t ... send sigterm to stumpwm)
   # svc -x ~/supervise/stumpwm
   # svc -t ~/supervise/stumpwm
* Show status of my running supervised tools
  # svstat ~/supervise/*


Stefan.

>
> ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
> On Tuesday, April 7, 2020 6:58 PM, Eric Ihli <address@hidden> wrote:
>
>
>     Sometimes my graphic environment locks up. I think this is a
>     StumpWM issue since my keyboard and mouse continue to "work". I
>     can move the mouse around and switch to a different tty using
>     ctrl-alt-f<n>. But nothing works in the tty where I ran `startx`.
>    
>     What can be done from a different tty to troubleshoot/fix the
>     issue? I've tried `stumpish` from another tty but I get the error
>     `xprop: unable to open display`.
>    
>     Other possibly relevant info is that my `.xinitrc` launches
>     StumpWM with `dbus-launch --with-exit-session --sh-syntax stumpwm
>     `.
>    
>     Thanks,
>     Eric



reply via email to

[Prev in Thread] Current Thread [Next in Thread]