home · contact · privacy
Fix. master
authorChristian Heller <c.heller@plomlompom.de>
Sat, 17 May 2025 21:59:56 +0000 (23:59 +0200)
committerChristian Heller <c.heller@plomlompom.de>
Sat, 17 May 2025 21:59:56 +0000 (23:59 +0200)
bookworm/aptmark/seedbox
bookworm/copy/all/home/plom/.bashrc
bookworm/copy/seedbox/etc/systemd/system/rtorrent.service
bookworm/copy/seedbox/home/plom/.bashrc.seedbox [new file with mode: 0644]
bookworm/copy/seedbox/home/plom/.local/bin/kill_rtorrent [new file with mode: 0755]
testing/copy/desktop/home/plom/.bashrc.desktop

index bf6235458d586feaa1b7ee6083e575e6849c2729..8742dfc76c30368ae9f7075833c616de4845b063 100644 (file)
@@ -1,5 +1,5 @@
 # needed for torrenting
 rtorrent
 # needed for torrenting session
-tmux
+dtach
 #
index e74831500aba0e3919636e85014b46c9970baed9..e8c939e8839805d7413cd49d94ce74edfbfe1dd2 100644 (file)
@@ -5,7 +5,6 @@ export VISUAL=vim
 export EDITOR="${VISUAL}"
 
 # Some helpful aliases.
-alias curlpost='curl -H "Content-Type: application/json" -X POST'
 alias ls="ls --color=auto"
 
 # Colored prompt with username, hostname, date/time, directory.
index a8a91f35920c3970140d55ab4fd19b386609a311..a62e12446a0a320938398b8f3fce0a8ba086bcb7 100644 (file)
@@ -1,15 +1,15 @@
 [Unit]
-Description=rtorrent in tmux session
+Description=rtorrent dtached
 After=network.target
 
 [Service]
-Type=forking
+Type=simple
 User=plom
 WorkingDirectory=/home/plom
-ExecStartPre=-/bin/rm -f /home/plom/session/rtorrent.lock
-ExecStart=/usr/bin/tmux new-session -d -s rtorrent_tmux /usr/bin/rtorrent
-ExecStop=/usr/bin/tmux kill-session -t rtorrent_tmux
-Restart=always
+ExecStart=/bin/sh -lc "rm -rf session/rtorrent.lock && dtach -n /tmp/dtach_rtorrent rtorrent && while true; do sleep 1; test ! -e /tmp/dtach_rtorrent && break; done"
+ExecStop=/bin/sh -lc kill_rtorrent
+Environment=TERM=linux
+Restart=on-success
 RestartSec=10
 
 [Install]
diff --git a/bookworm/copy/seedbox/home/plom/.bashrc.seedbox b/bookworm/copy/seedbox/home/plom/.bashrc.seedbox
new file mode 100644 (file)
index 0000000..e9f3dc6
--- /dev/null
@@ -0,0 +1 @@
+alias attach_rtorrent='dtach -a /tmp/dtach_rtorrent -e "^t"'
diff --git a/bookworm/copy/seedbox/home/plom/.local/bin/kill_rtorrent b/bookworm/copy/seedbox/home/plom/.local/bin/kill_rtorrent
new file mode 100755 (executable)
index 0000000..79bbdaa
--- /dev/null
@@ -0,0 +1,11 @@
+#!/bin/sh
+set -e
+
+PIDs=$(ps hao 'pid comm' | grep -E '^[[:blank:]]*[[:digit:]]+ rtorrent$' | sed -E 's/^[[:blank:]]+([[:digit:]]+).*$/\1/g')
+if [ ! -z "${PIDs}" ]; then
+    echo "Killing $(echo ${PIDs} | wc -w) instance(s)."
+    kill -9 "${PIDs}"
+else
+    echo 'Nothing to kill.'
+fi
+rm -rf /tmp/dtach_rtorrent
index baa8d8b5cb299b4a969eac7ebdc81a1e35851932..e79371927aa26c6e3275f7fdd839fbc210c3872e 100644 (file)
@@ -2,3 +2,6 @@
 # a non-existing "en" layout
 alias kb_de="swaymsg 'input * xkb_layout de'"
 alias kb_us="swaymsg 'input * xkb_layout us'"
+
+# miscellaneaous
+alias curlpost='curl -H "Content-Type: application/json" -X POST'