feat: run-and-kill script (#6188)

This commit is contained in:
pajlada
2025-05-04 15:11:26 +02:00
committed by GitHub
parent c7e1c2e812
commit 0cfe65410d
2 changed files with 41 additions and 0 deletions
+40
View File
@@ -0,0 +1,40 @@
#!/usr/bin/env bash
set -e
# This is a script that runs then kills chatterino at random intervals
# You can modify the _min_ms and _rand_ms to change how often they're killed
_min_ms="1000"
_rand_ms="8000"
if [ -z "$1" ]; then
echo "usage: $0 <path_to_chatterino_bin_to_run> (e.g. $0 ./build-mold/bin/chatterino)"
exit
fi
bin_to_run="$1"
while true; do
sleep_time_ms=$(( RANDOM % _rand_ms + _min_ms ))
sleep_time="$(echo "${sleep_time_ms}/1000" | bc)"
$bin_to_run &
pid=$!
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ">>>>>>> SLEEPING FOR ${sleep_time}s"
(sleep "$sleep_time" && echo "" && echo "<<<<<<<<<<<<< TRY KILL" && kill -SIGINT "$pid") &
wait "$pid"
sleep 0.5
done