update
modified: content/2020-09-15-weechat-on-boot-in-a-tmux-session.rst
This commit is contained in:
parent
c70ade91cb
commit
752f1766ae
1 changed files with 15 additions and 9 deletions
|
|
@ -9,37 +9,43 @@ WeeChat on-boot in a tmux session
|
|||
|
||||
Chronicles of a washed up systems administrator.
|
||||
|
||||
In the basement, M. Bison (`mbision.foxhop.net.`), a T430 with a cracked screen runs queitly with his lid closed, acting as a SmartOS hypervisor to 3 Solaris derived zones and 4 KVM ubuntu guests.
|
||||
In the basement, M. Bison (``mbision.foxhop.net.``), a T430 with a cracked screen runs queitly with his lid closed, acting as a SmartOS hypervisor to 3 Solaris derived zones and 4 KVM ubuntu guests.
|
||||
|
||||
One of these guests is the oldest of the bunch and his name is Akuma (`akuma.foxhop.net.`). Akuma and I go way back, over 15 years now. At one point akuma was a physical machine, which ran ubuntu and had it's own guest operating systems. Akuma has been "home base" for a long time, a place to SSH jump from and a place to perform operations. This server is the Salt Master and also a private internal DNS server running Bind9.
|
||||
One of these guests is the oldest of the bunch and his name is Akuma (``akuma.foxhop.net.``).
|
||||
|
||||
To use Akuma as a "remote shell", one which I can connect and disconnect to from anywhere in the world, I use `tmux` (previously `screen`) with defaults settings.
|
||||
Akuma and I go way back, over 13 years now. At one point Akuma was a physical machine, who ran ubuntu and had it's own guest operating systems.
|
||||
|
||||
Akuma reboots weekly to perform a complete system backup (stored without compression on Guile, a FreeNAS server running on an HP G6 180 [link to that blog post])
|
||||
Akuma has been "home base" for as long as I remember. A place a "jump box" where shit got done. A place to perform operations. It make sense that Akuma would evolve into the private internal DNS Nameserver for ``foxhop.net.`` and other domains, and also take on Salt Master resposibilities.
|
||||
|
||||
Since Akuma reboots so frequently, it creates a tmux session on boot, configured using SaltStack:
|
||||
Akuma uses ``tmux`` with default settings to enable "remote shell" vibe.
|
||||
|
||||
This lets me connect to my session running on Akuma from anywhere in the world.
|
||||
|
||||
Only problem is, Akuma reboots weekly when M. Bison `triggers a complete backup of all guests </backup-all-virtual-machines-on-a-smartos-hypervisor-with-smart-back-sh/>`_ (snapshots are stored in-the-raw [uncompressed] on Guile, the FreeNAS server).
|
||||
|
||||
Since Akuma reboots so frequently, to continue to function as my "home base" I needed a way to create a tmux sessions on boot, and I did so using SaltStack:
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
create-tmux-session-on-boot:
|
||||
cron.present:
|
||||
- comment: "create a new tmux session on system boot"
|
||||
- name: /home/fox/new-tmux
|
||||
- name: /bin/bash /home/fox/new-tmux
|
||||
- identifier: "create-tmux-session-on-boot"
|
||||
- special: "@reboot"
|
||||
- user: fox
|
||||
- require:
|
||||
- user: fox
|
||||
|
||||
This salt state results in the following `crontab -l` entry:
|
||||
This salt state results in the following ``crontab -l`` entry:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
# create a new tmux session on system boot SALT_CRON_IDENTIFIER:create-tmux-session-on-boot
|
||||
@reboot /home/fox/new-tmux
|
||||
@reboot /bin/bash /home/fox/new-tmux
|
||||
|
||||
|
||||
And of course I would be terrible if I didn't share with you the contents of `/home/fox/new-tmux`:
|
||||
And of course I what tutorial wouldn't be complete without a script! (``/home/fox/new-tmux``) :
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue