thumbnail of my-wn-layout_20260322.04:50:51.png
thumbnail of my-wn-layout_20260322.04:50:51.png
my-wn-layout_20260322... png
(1.75 MB, 1904x1913)
This Elisp function makes a lot of assumptions about environment variables and database connection names, but it works for me.


(defun my/wn-layout ()
  "Create a layout for owrking on WeatherNews."
  (interactive)
  (let* ((query-file (concat (getenv "WN")  "/sql/queries.sql"))
         (db-file    (concat (getenv "CGI") "/wn.db"))
         (esh2       (get-buffer "*eshell*<2>")))
    (find-file query-file)
    (delete-other-windows)
    (split-window-below)
    (sql-connect "wn.db")
    (windmove-down)
    (eshell)
    (split-window-right)
    (windmove-right)
    (if esh2
        (switch-to-buffer esh2)
      (eshell 2))))


This is how I'm doing light maintenance of the database on tilde.club.  They rebooted the server yesterday, and the user-level systemd service didn't automatically start, so I had to backfill the database a little bit, and manually start the service that updates the database.

I also set the timezone of the shell account and its cron jobs to Asia/Tokyo which makes debugging a little easier.