Skip to content

Commit

Permalink
scripts/bindhosts: better stdout for cron feature
Browse files Browse the repository at this point in the history
  • Loading branch information
backslashxx committed Dec 16, 2024
1 parent 84f0c68 commit c66d241
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions module/bindhosts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,18 @@ enable_cron() {
echo "[+] running crond"
busybox crond -bc $PERSISTENT_DIR/crontabs -L /dev/null
}
echo "[+] adding crontab entry"
echo "0 4 * * * sh /data/adb/modules/bindhosts/bindhosts.sh --force-update > $rwdir/bindhosts_cron.log 2>&1 &" | busybox crontab -c $PERSISTENT_DIR/crontabs -
echo "[>] $(head -n1 $PERSISTENT_DIR/crontabs/root) "
echo "[+] crontab entry added!"
}

disable_cron() {
if grep -q "bindhosts.sh" $PERSISTENT_DIR/crontabs/root > /dev/null 2>&1; then
echo "[ ] removing crontab entry"
echo "[ ] $(head -n1 $PERSISTENT_DIR/crontabs/root) "
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
echo "[x] no crontab entry found!"
fi
Expand Down

0 comments on commit c66d241

Please sign in to comment.