diff options
| author | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2025-08-23 13:36:06 +0900 |
|---|---|---|
| committer | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2025-08-23 13:36:06 +0900 |
| commit | 6baef1437fcf40b1d51c5255af78ab297d361d2c (patch) | |
| tree | c3c257e026ec3fb32b787839f81d8af0c2e6c7ce /mac/.local/bin/cron/crontog | |
| parent | 07d294425a98ee5d1e22d03e2b24ae2c76e487c0 (diff) | |
updates
Diffstat (limited to 'mac/.local/bin/cron/crontog')
| -rwxr-xr-x | mac/.local/bin/cron/crontog | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/mac/.local/bin/cron/crontog b/mac/.local/bin/cron/crontog new file mode 100755 index 0000000..70e7cf1 --- /dev/null +++ b/mac/.local/bin/cron/crontog @@ -0,0 +1,26 @@ +#!/bin/sh + +# Toggles all cronjobs off/on. +# Stores disabled crontabs in ~/.config/crons until restored. + +cron_file="${XDG_CONFIG_HOME:-$HOME/.config}/crons" + +# Check if there are any active cronjobs +if crontab -l 2>/dev/null | grep -q '^[^#[:space:]]'; then + # If active cronjobs are found, save and disable them + ln -sf "${XDG_DOTFILES_DIR:-${HOME}/.dotfiles}/$(whereami)/.config/crons" "${XDG_CONFIG_HOME:-${HOME}/.config}/crons" + crontab -r + notify-send "⏰ Cronjobs saved and disabled." +else + # If no active cronjobs are found, try re-enabling from saved file + if [ -f "$cron_file" ]; then + crontab - <"$cron_file" + rm "$cron_file" + notify-send "🕓 Cronjobs re-enabled." + else + notify-send "🕰️ No saved cronjobs to re-enable." + fi +fi + +# Notify status bar to update +pkill -RTMIN+3 "${STATUSBAR:-dwmblocks}" |
