Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so dont bother with any of their useless mail servers here and just use oauth login instead. Thank the nice Russians for causing that. :)
Paste
Pasted as Bash by registered user uwe ( 13 years ago )
#!/bin/bash
# check every x seconds
checktime=10
# what to check, needs to have exit code 0 if sigSTOP should be issued
check="lsof -Pni :8200 -sTCP:ESTABLISHED"
# what pids to sigSTOP
pids="lsof -t -c par2 -c unrar -c python -c rtmpdump -c rsync"
# paused-file
pausef="/media/crypt/dl/run/paused"
# pid-file
pidf="/media/crypt/dl/run/sigstop.pid"
# main
paused=0
while sleep "$checktime"; do
if $check; then
$pids | xargs kill -STOP
paused=1
touch "$pausef"
continue
fi
if [ $paused -eq 1 ]; then
$pids | xargs kill -CONT
rm "$pausef"
paused=0
fi
done&
echo $! > "$pidf"
disown
Revise this Paste