* DONE Crontab screwing up my tmux shell :blog:tech:linux: :PROPERTIES: :ID: crontab-tmux-default-shell :CREATED: [2024-11-22 Fri] :END: :LOGBOOK: - Amendment about env [2024-11-26 Tue] - State "DONE" from [2024-11-22 Fri 14:09] :END: In the last days I was suddenly faced with an oddly persistent issue: New tmux sessions were started with ~sh~ instead of my default shell. Even changing my ~.tmux.conf~ did not seem to make a difference: : set -g default-shell /bin/zsh Then the internet reminded me that tmux is driven by a server process. Killing the process and having it restart by creating a new session magically brought it back to my default shell ~zsh~. So something must have started this tmux session without my default shell. I also noticed that this happened reliably in my new tmux session started at boot to control my Framework 16 LED Matrix. Realizing that also my whole environment (mainly populated by ~.zshenv~) was missing, I started to put one and one together. ** An inconspicuous crontab change Apparently, the crontab session was the actual culprit. Through launching a tmux session in my user crontab with ~@reboot~ a tmux server process was launched without my environment. This seems to be a general issue with at least personal crontabs as a minutious cronjob to print out ~env~ showed me: : */1 * * * * env Observed via: : journalctl --no-hostname --follow I could not find a way to have ~cron~ use the default user shell, so instead I put ~SHELL=/bin/zsh~ at the top of my crontab file, which also correctly initialized the whole environment. ** Amendment: Graphical Environment Not all environment is present though - unlike when I run tmux later, the graphical desktop environment is not yet present, so in case I want to run something that depends on this, I need to go back and ~pkill tmux~ to get a server with the whole environment. Short of not using tmux in my crontab, I have not found a solution for that yet. I guess crontab might not be the right choice here, but an xdg autostarted .deskop-file.