File tree Expand file tree Collapse file tree 2 files changed +49
-2
lines changed Expand file tree Collapse file tree 2 files changed +49
-2
lines changed Original file line number Diff line number Diff line change 1414 <integer >5 </integer >
1515 <key >RunAtLoad </key >
1616 <true />
17+ <key >KeepAlive </key >
18+ <true />
1719 <key >StandardErrorPath </key >
18- <string >/dev/null </string >
20+ <string >/Users/rafa.gomez/Library/Logs/cron.5seconds.error.log </string >
1921 <key >StandardOutPath </key >
20- <string >/dev/null </string >
22+ <string >/Users/rafa.gomez/Library/Logs/cron.5seconds.out.log </string >
23+ <key >EnvironmentVariables </key >
24+ <dict >
25+ <key >PATH </key >
26+ <string >/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/rafa.gomez/.dotfiles/bin </string >
27+ <key >DOTFILES_PATH </key >
28+ <string >/Users/rafa.gomez/.dotfiles </string >
29+ <key >DOTLY_PATH </key >
30+ <string >/Users/rafa.gomez/.dotfiles </string >
31+ </dict >
2132 </dict >
2233</plist >
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+ # #? Check and restart cron LaunchAgent if needed
4+ # #?
5+ # #? Usage:
6+ # #? check_cron_agent
7+
8+ set -euo pipefail
9+
10+ source " $DOTLY_PATH /scripts/core/log.sh"
11+
12+ AGENT_LABEL=" com.user.cron.5seconds"
13+ PLIST_PATH=" $HOME /Library/LaunchAgents/${AGENT_LABEL} .plist"
14+
15+ main () {
16+ if ! launchctl list " $AGENT_LABEL " > /dev/null 2>&1 ; then
17+ log::warning " LaunchAgent $AGENT_LABEL is not running. Reloading..."
18+
19+ if [[ -f " $PLIST_PATH " ]]; then
20+ launchctl load " $PLIST_PATH " 2> /dev/null || {
21+ log::error " Failed to load LaunchAgent"
22+ exit 1
23+ }
24+
25+ log::success " LaunchAgent reloaded successfully"
26+ else
27+ log::error " Plist file not found: $PLIST_PATH "
28+
29+ exit 1
30+ fi
31+ else
32+ log::success " LaunchAgent $AGENT_LABEL is running"
33+ fi
34+ }
35+
36+ main " $@ "
You can’t perform that action at this time.
0 commit comments