0

I have a script that runs diskutil and since diskutil needs permissions to run I'm running the script from the root's crontab.

Steps:

  1. sudo su root
  2. crontab -e
            • sh /test.sh
  3. Nothing ever happens

After typing sudo su root, typing sh /test.sh successfully runs the script.

Any ideas?

7
  • Where exactly is test.sh stored?
    – nohillside
    Commented Jan 16, 2020 at 13:57
  • to be safe both in: /test.sh and /Users/me/test.sh - after typing sudo su root and then pwd the path is /Users/me/
    – Malooii
    Commented Jan 16, 2020 at 14:30
  • See this answer regarding diagnosing cron (you should be using launchd, BTW). Also, you should be using the full path to test.sh because root doesn’t inherit your path.
    – Allan
    Commented Jan 16, 2020 at 16:47
  • I can't use mail in root made, and no luck with using the full path to the test.sh file - I have just tried to run test.sh using a launchd .plist file, but no luck - is it possible to run my .sh using launchd?
    – Malooii
    Commented Jan 16, 2020 at 17:24
  • Not the Mail app (GUI), but mail from the command line - very different. Also, how are you even putting files in the root folder? By default, macOS doesn’t let you write there, much less execute from there. I think there’s a lot missing from the Q.
    – Allan
    Commented Jan 16, 2020 at 17:43

0

You must log in to answer this question.

Browse other questions tagged .