summaryrefslogtreecommitdiffstats
path: root/filehooker/root-image/krebs
diff options
context:
space:
mode:
Diffstat (limited to 'filehooker/root-image/krebs')
-rwxr-xr-xfilehooker/root-image/krebs/bin/start-ncdc.ship4
-rw-r--r--filehooker/root-image/krebs/lib/filehooker3
2 files changed, 5 insertions, 2 deletions
diff --git a/filehooker/root-image/krebs/bin/start-ncdc.ship b/filehooker/root-image/krebs/bin/start-ncdc.ship
index e190ec06..3251ef53 100755
--- a/filehooker/root-image/krebs/bin/start-ncdc.ship
+++ b/filehooker/root-image/krebs/bin/start-ncdc.ship
@@ -6,6 +6,9 @@ set -euf
ncdc_user="hooker"
useradd -m $ncdc_user ||:
+sudo -u $ncdc_user /usr/bin/tmux new-session -s dcpp -n ncdc -d ncdc 2>/dev/null || echo "ncdc is already running"
+
+
dc_hub="adcs://elch.nsupdate.info:2781"
ncdc_configure_hub "$dc_hub" "elch"
@@ -14,5 +17,4 @@ ncdc_configure_nick "$nick"
share_all_partitions
-sudo -u $ncdc_user /usr/bin/tmux new-session -s dcpp -n ncdc -d ncdc
exit 0
diff --git a/filehooker/root-image/krebs/lib/filehooker b/filehooker/root-image/krebs/lib/filehooker
index c72d4d51..c51be701 100644
--- a/filehooker/root-image/krebs/lib/filehooker
+++ b/filehooker/root-image/krebs/lib/filehooker
@@ -9,7 +9,8 @@ ncdc_bin=${ncdc_bin:-/usr/bin/ncdc}
ncdc_config(){
# maybe we want to use the running ncdc process and communicate via tmux send-keys ?
txt="$(cat)"
- (sleep 1;printf "%s" "$txt";printf "/quit\n") | sudo -u $ncdc_user "$ncdc_bin" 2>/dev/null || \
+# printf "%s" "$txt"
+ ! sudo -u $ncdc_user /usr/bin/tmux has-session -t dcpp && echo "ncdc session must be running" && exit 1
sudo -u $ncdc_user /usr/bin/tmux send-keys -t dcpp:ncdc "$txt" C-m
}