Skip to content

Commit

Permalink
scripts/bindhosts: add crond killer on disable_cron
Browse files Browse the repository at this point in the history
this way we can prevent multiple crond running
and we clean only our own crond

busybox pidof busybox for added hilarity
  • Loading branch information
backslashxx committed Dec 16, 2024
1 parent c66d241 commit 05d5110
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions module/bindhosts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,16 @@ enable_cron() {
}

disable_cron() {
# kill busybox crond that we enabled
for i in $(busybox pidof busybox); do
# super leet gamma knife
grep -q "bindhosts" /proc/$i/cmdline > /dev/null 2>&1 && {
echo "[x] killing pid $i"
kill -9 $i
}
done
# clean entry
if grep -q "bindhosts.sh" $PERSISTENT_DIR/crontabs/root > /dev/null 2>&1; then
echo "[>] $(head -n1 $PERSISTENT_DIR/crontabs/root) "
# todo: find a way to kill busybox crond
# with just toybox ps
rm -rf $PERSISTENT_DIR/crontabs
echo "[x] crontab entry removed!"
else
Expand Down

0 comments on commit 05d5110

Please sign in to comment.