Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to set up crontab to run a shell script, but for some reason, the script doesn't get executed. I'm on system with OS X 10.8.5.

crontab file

0 12 * * 1 /absolute/path/to/myscript.sh
0 15 * * 2 /absolute/path/to/myscript.sh
30 10 * * 3 /absolute/path/to/myscript.sh
0 18 * * 3 /absolute/path/to/myscript.sh
30 10 * * 4 /absolute/path/to/myscript.sh

myscript.sh

#!/bin/sh
cd /Users/me/Documents/targetfile/ && git add . && git commit -m "Added notes for $(date)" && git push -u origin master

The script runs fine when it's launched manually, using a shell, but produces only these entries in Console.app:

launchctl: launchctl: Dubious permissions on file (skipping): /Library/LaunchAgents/com.adobe.AAM.Updater-1.0.plist

I have executed chmod 777 myscript.sh as well as the error-raising .plist file, but to no avail.

EDIT: ls -l /Library/LaunchAgents/com.adobe.AAM.Updater-1.0.plist outputs:

-rwxrwxrwx  1 root  wheel  612  2 Aug 18:57 /Library/LaunchAgents/com.adobe.AAM.Updater-1.0.plist

and ls -ld /Library/LaunchAgents

drwxr-xr-x  22 root  wheel  748 10 Sep 21:12 /Library/LaunchAgents

I did set up the crontab using root, and I have no idea whatsoever what that plist has to do with the script I'm trying to do.

What's wrong with my setup?

share|improve this question
    
Please edit your question to include the output of ls -l /Library/LaunchAgents/com.adobe.AAM.Updater-1.0.plist as well as ls -ld /Library/LaunchAgents (assuming OS X ls works similar to GNU ls). Also, please explain how it is related to your script. – Michael Kjörling Sep 23 '13 at 14:59
    
1  
Are other commands (like for example * * * * * say a) run from crontab? Did you try adding the command to the user's crontab? – user495470 Sep 23 '13 at 15:11
    
* * * * * say a doesn't work when crontab is edited from root or user. – Jules Sep 23 '13 at 15:31
1  
I wonder if the "dubious" permission error is given because there are too many permissions: Try 755 instead of 777 – glenn jackman Sep 23 '13 at 17:39

add to your crontab line : &>/tmp/myscript.log

for example :

0 12 * * 1 /absolute/path/to/myscript.sh &>/tmp/myscript.log

and wait for the script to executes and check the myscript log, I assume that the possible errors will be " git command not found " or " cd command not found" , if that was the case then you have to locate the full path of theses commands via 'find' or 'locate' and enter its full path, for example instead of cd use /path_to_cd/cd etc..

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .