Edit: This question is NOT a duplicate of How do I restart the cron service on OSX? as I explained in point 3...
I am busy trying to test a process that's started using the crontab
on macOS High Sierra. I cannot seem to kill it easily so that I can make a change and re-run it to test my change.
I can tell what the cron
process is doing as I am logging the output/process to a text file and tailing -f
it in terminal, anything I have tried hasn't stopped the job.
Here's what I have tried:
Listing processes (aux) via
ps aux | grep cron
doesn't list anything that looks like my currently runningcronjob
.ps -ef | grep cron
shows three processes but none of them are the job itself as far as I can tell, list shown below:0 41453 1 0 12:55pm ?? 0:00.01 /usr/sbin/cron 503 38049 37800 0 12:04pm ttys002 0:00.24 tail -f cron-test.txt 503 42548 38511 0 1:24pm ttys003 0:00.00 grep --color=auto --exclude-dir=.bzr --exclude-dir=CVS --exclude-dir=.git --exclude-dir=.hg --exclude-dir=.svn cron
I tried unloading/loading the launch daemon (How do I restart the cron service on OSX?) which
cron
is run through but, trying to do this requires that System Integrity Protection be disabled. Doing this requires me to reboot in recovery mode which is pointless, I may as well then just reboot the Mac everytime.
crontab -l
output in case its relevant.
*/44 * * * * cd /Users/my_user_name/Development/Sites/website-handover-dev/web && \
./cron-test.sh && \
time ./cron-test.sh >> /Users/my_user_name/Development/Sites/website-handover-dev/web/cron-test.txt 2>&1
crontab
entry or entries from the user'scrontab
.cron
wakes every minute, checks if a entry needs to be run, and also checks the modification time of a crontab,. Thus the crontab entry will be stopped if removed. There is no need to stop and restart cron. – fd0 Jun 06 '18 at 13:06cron-test.sh
script run? – nohillside Jun 06 '18 at 13:12grep cron
catch the process name? Wouldn't the process thatcron
started run under its own name? Also - are you using the same userid for your commands that the crontab is using? – Seamus Jun 06 '18 at 17:31