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:

  1. Listing processes (aux) via ps aux | grep cron doesn't list anything that looks like my currently running cronjob.

  2. 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
  3. 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
  • 2
    Possible duplicate of How do I restart the cron service on OSX? – Nimesh Neema Jun 6 '18 at 12:46
  • Edited the title, apologies slight error - Need to stop the currently running job – John Cogan Jun 6 '18 at 13:00
  • Simply, remove the crontab entry or entries from the user's crontab. 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 6 '18 at 13:06
  • 1
    How long does the cron-test.sh script run? – nohillside Jun 6 '18 at 13:12
  • @nohillside - more than 20 minutes (Contact API for data and does several other items. sh Script runs a Drupal Drush command) – John Cogan Jun 6 '18 at 13:33

You must log in to answer this question.

Browse other questions tagged .