Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support @ crontab notation #28

Merged
merged 3 commits into from
Nov 13, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion maclaunch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,20 @@ function getKernelExtensions {
}

function getCronjobs {
crontab -l 2>/dev/null | grep -v '^#' | cut -d ' ' -f 6
while IFS= read -r cron; do
if echo "$cron" | cut -d ' ' -f 1 | grep -q '@'; then
# @reboot notation
echo "$cron" | cut -d ' ' -f 2
else
# * * * * * notation
echo "$cron" | cut -d ' ' -f 6
fi
done <<<"$(crontab -l 2>/dev/null | grep -v '^#' | grep -vE '^\n')"
}

getCronjobs
exit 1

function listCronJobs {
hazcod marked this conversation as resolved.
Show resolved Hide resolved
local filter="$1"
hazcod marked this conversation as resolved.
Show resolved Hide resolved

Expand Down