summaryrefslogtreecommitdiff
path: root/debian/.local/bin/cron/crontog
diff options
context:
space:
mode:
authorTheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com>2025-12-24 13:54:03 +0900
committerTheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com>2025-12-24 13:54:03 +0900
commit28e8bdf7f8286bd431b7f3b709e79f3827b31469 (patch)
tree85b44eff6da4d8443198fb6e04dfb6ee55244588 /debian/.local/bin/cron/crontog
parent8470ff001befcfd0f626dea69a9e76d43aee0511 (diff)
updates
Diffstat (limited to 'debian/.local/bin/cron/crontog')
-rwxr-xr-xdebian/.local/bin/cron/crontog26
1 files changed, 26 insertions, 0 deletions
diff --git a/debian/.local/bin/cron/crontog b/debian/.local/bin/cron/crontog
new file mode 100755
index 0000000..70e7cf1
--- /dev/null
+++ b/debian/.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}"