0

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?

8

1 Answer 1

0

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..

You must log in to answer this question.

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