diff --git a/tasks/workstation/linux/software/llm.yml b/tasks/workstation/linux/software/llm.yml index 391669e..6ac39ec 100644 --- a/tasks/workstation/linux/software/llm.yml +++ b/tasks/workstation/linux/software/llm.yml @@ -385,7 +385,7 @@ #!/bin/sh exec 2>&1 # $1 is the exit code, $2 is the exit status byte (signal number if killed) - echo "Service finished with exit code: $1 and status: $2" + echo "FINISH: Service returned with exit code: $1 and status: $2" echo "FINISH: Stopping..." docker stop open-webui && @@ -424,6 +424,66 @@ # Open WebUI - End # + # Swap Stopper - Start # + + - name: Workstation | Linux | Software | LLMs | runit | swap-stopper | Script | Executable + ansible.builtin.copy: + dest: "{{ global_bin }}/llm_swap_stopper.sh" + src: files/scripts/llm_swap_stopper.sh + mode: "0755" + + - name: Workstation | Linux | Software | LLMs | runit | swap-stopper | Dir | /etc/sv + ansible.builtin.file: + name: "/etc/sv/swap-stopper/log" + state: directory + owner: root + mode: "0755" + + - name: Workstation | Linux | Software | LLMs | runit | swap-stopper | Dir | /var/log + ansible.builtin.file: + name: "/var/log/swap-stopper" + state: directory + owner: "{{ user }}" + mode: "0755" + + - name: Workstation | Linux | Software | LLMs | runit | swap-stopper | Script | Run + ansible.builtin.copy: + dest: /etc/sv/swap-stopper/run + content: | + #!/bin/sh -e + exec 2>&1 + exec {{ global_bin }}/llm_swap_stopper.sh + mode: "0755" + + - name: Workstation | Linux | Software | LLMs | runit | swap-stopper | Script | Finish + ansible.builtin.copy: + dest: /etc/sv/swap-stopper/finish + content: | + #!/bin/sh -e + exec 2>&1 + # $1 is the exit code, $2 is the exit status byte (signal number if killed) + echo "FINISH: Service returned with exit code: $1 and status: $2" + mode: "0755" + + - name: Workstation | Linux | Software | LLMs | runit | swap-stopper | Script | Log + ansible.builtin.copy: + dest: /etc/sv/swap-stopper/log/run + content: | + #!/bin/sh -e + exec svlogd -tt /var/log/swap-stopper + mode: "0755" + + - name: Workstation | Linux | Software | LLMs | runit | swap-stopper | Script | Log Config + ansible.builtin.copy: + dest: /var/log/swap-stopper/config + content: | + s1000000 # rotate at 1 MB + n5 # keep 5 old files + dateformat %Y-%m-%d_%H-%M-%S # each run gets its own file. + mode: "0755" + + # Swap Saver - End # + when: ansible_service_mgr == "runit" # Services - Start # @@ -438,6 +498,7 @@ - { 'name': "{{ zeroclaw }}", 'status': "{{ zeroclaw_enabled }}" } - { 'name': 'docker' , 'status': true } - { 'name': 'open-webui' , 'status': "{{ open_webui_enabled }}" } + - { 'name': 'swap-stopper' , 'status': true } - name: Workstation | Linux | Software | LLMs | Services | Verify ansible.builtin.uri: