I recently had to re-install 10.9.5 (default install) and am now finding that bash scripts that run perfectly from the command line (~/Me…) no longer work using crontab. I use crontab to invoke "Diskutil unmount volumeX" but am getting mail from cron saying "diskutil" command not found. Is it a PATH issue and if so how would I fix it.
Thank you in advance for any help.
MacOS – Getting unknown command error when trying to run script via cron
bashcronmacos
Related Question
- MacOS – How to move the cursor past the end of the line in Insert mode when using vi-style line editing on bash
- How to control where script run by cron saves files
- How to pass a file set as a variable from AppleScript to a Bash shell script
- Problems executing an osascript command via cron
- MacOS – rbenv global version of ruby vs Sierra ruby version
- Cron mail notifies error of suspicious unknown script
- MacOS – cron lacks permissions to run a script
Best Answer
cron
uses/usr/bin:/bin
as the defaultPATH
anddiskutil
is in/usr/sbin
.Specify the full path to
diskutil
or add a line likePATH=/usr/bin:/bin:/usr/sbin:/sbin
to the start of your crontab.Enter
which diskutil
to find its path, or enterecho $PATH
to find the path where your commands are working.