Mac OSX Cron Script Execution


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Mac OSX Cron Script Execution
# 1  
Old 01-30-2010
Mac OSX Cron Script Execution

Hello,

On Mac OSX, I was wondering about my Cron Script:
Code:
HELL=/bin/tcsh
PATH=/sbin:/bin:/usr/sbin:/usr/bin
HOME=/var/log
MAILTO=jwillis
25      1       *       *       *       root    /Users/jwillis/Fbcmd\Scripts/DailyBirthday.scr

my returned message is:
Code:
Subject: Cron <jwillis@Macintosh-66> root  /Users/jwillis/Fbcmd\ Scripts/DailyBirthday.scr
X-Cron-Env: <SHELL=/bin/tcsh>
X-Cron-Env: <PATH=/sbin:/bin:/usr/sbin:/usr/bin>
X-Cron-Env: <HOME=/Users/jwillis>
X-Cron-Env: <MAILTO=jwillis>
X-Cron-Env: <LOGNAME=jwillis>
X-Cron-Env: <USER=jwillis>
Message-Id: <20100123072500.C587886CC46@Macintosh-66.local>
Date: Sat, 23 Jan 2010 01:25:00 -0600 (CST)

root: Command not found.

I've also tried my user name instead of root.

Additionally, this script wouldn't run if I were not logged in at 1:25 AM. Would it run the next login or is there a way to set that?


Thanks,
J
# 2  
Old 01-30-2010
I wonder if your cron script did not paste correctly?

Unless MACOS has a very different cron(8) to other Unixes then you switch to the root user and edit the crontab(5) if you root to run the crontab(1). AS root you can edit other users crontabs.

To edit rot crontab as yourself you can do:
Code:
$ sudo crontab -e

The crontab is expected to specify when to run something and then what to run with any parameters, so it is treating "root" as what to run and then your script as the parameter to it, drop the root word and see how you get on.
# 3  
Old 01-31-2010
thats odd.

For the first try I removed root and received:
Code:
From: jwillis@macintosh-66.dhcp.mc.vanderbilt.edu (Cron Daemon)
To: jwillis@macintosh-66.dhcp.mc.vanderbilt.edu
Subject: Cron <jordanwillis@macintosh-66> /Users/jwillis/Fbcmd\ Scripts/DailyBirthday.scr
X-Cron-Env: <SHELL=/bin/tcsh>
X-Cron-Env: <PATH=/sbin:/bin:/usr/sbin:/usr/bin>
X-Cron-Env: <HOME=/Users/jwillis>
X-Cron-Env: <MAILTO=jwillis>
X-Cron-Env: <LOGNAME=jwillis>
X-Cron-Env: <USER=jwillis>
Message-Id: <20100131040701.725B78C4BFD@macintosh-66.dhcp.mc.vanderbilt.edu>
Date: Sat, 30 Jan 2010 22:07:01 -0600 (CST)

/Users/jwillis/Fbcmd Scripts/DailyBirthday.scr: line 1: fbcmd: command not found

as expected...

for the sudo crontab -e it just returned the same thing a jwillis user did in "root not found"
# 4  
Old 01-31-2010
Do not use spaces in filenames or directory names in Unix it only causes trouble as you have now seen!

Change:
Code:
/Users/jwillis/Fbcmd\ Scripts/DailyBirthday.scr\ Scripts/DailyBirthday.scr

with:
Code:
"/Users/jwillis/Fbcmd\ Scripts/DailyBirthday.scr Scripts/DailyBirthday.scr"

 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Execution problem with Cron: Script works manually but not w/Cron. Why?

Hello gurus, I am making what I think is a simple db2 call from within a shell script but I am having difficulty producing the desired report when I run the script shown below from a shell script in cron. For example, my script and the crontab file setup is shown below: #!/bin/ksh db2... (3 Replies)
Discussion started by: okonita
3 Replies

2. OS X (Apple)

Creating Shell Script for STIG Checklist MAC OSX 10.6

Hello, I am new to Mac OSX and shell scripting all together. I was wondering if anyone could help get me started in a few scenarios so that I would be able to automate checking a system against a STIG checklist. A STIG Checklist is a DoD Guideline for securing systems. Here is the first... (3 Replies)
Discussion started by: john3j04
3 Replies

3. OS X (Apple)

Cron on Mac OSX

Hello, I was wondering about my Cron Script: HELL=/bin/tcsh PATH=/sbin:/bin:/usr/sbin:/usr/bin HOME=/var/log MAILTO=jwillis 25 1 * * * root /Users/jwillis/Fbcmd\Scripts/DailyBirthday.scrmy returned message is: Subject: Cron <jwillis@Macintosh-66> root ... (1 Reply)
Discussion started by: jwillis0720
1 Replies

4. Shell Programming and Scripting

#!/bin/bash and #1bin/sh command not found error on mac osx terminal/shell script

i am having a weird error on mac os x running some shell scripts. i am a complete newbie at this and this question concerns 2 scripts. one of which a friend of mine wrote (videochecker.sh) a couple weeks ago and it's been running fine on another machine. then last week i wrote capture.sh and it... (2 Replies)
Discussion started by: danpaluska
2 Replies

5. Shell Programming and Scripting

script execution differs in cron

I have the following script (MyScript): #!/bin/sh ps U erv | grep -v grep | grep -F "/usr/bin/collect -o 101" echo "Result: $?" When executed from the command line, I get ... (the line containing /usr/bin/collect -o 101) Result: 0 (which is correct since collect is running) When I... (4 Replies)
Discussion started by: lost_neko
4 Replies

6. Shell Programming and Scripting

Cron execution of shell script

Hi Guys, Unable to run this script from the cron,although the same executes perfectly from the command line.Please help. #!/bin/sh #### aprintd alarm creation files ##### file=`date +%m%d%Y` pid=$$ echo "$pid" /u01/app/netboss/bin/aprintd/aprintd > $file & childpid=$!... (3 Replies)
Discussion started by: ashish.sharma
3 Replies

7. Windows & DOS: Issues & Discussions

win-xp/mac-osx

I'm currently looking for an emulation program that would allow me to open and run osx app.s and programs on a windows xp based system. if not is there a unix/linux/lindows program that may do the same? (3 Replies)
Discussion started by: area51nstk
3 Replies

8. UNIX Desktop Questions & Answers

Mac Osx.2

I finally broke down and decided to buy a new piece of hardware. I think I made the right decision when I chose an Apple iBook - OSX is incredible! I haven't used a Mac since System7.5, and 10.2 is just blowing me away! Best of all, it's easy to use for people who are not used to Mac, but if I... (5 Replies)
Discussion started by: LivinFree
5 Replies

9. UNIX for Dummies Questions & Answers

XWindows on Mac OSX

Hello, I'm like most people who post here, I'm new in UNIX. Yesterday I installed Xwindows on my OSX box just to learn as much about UNIX as I can. I been messing around with my terminal and conf files that have to do with Apache and sendmail and didn't mess anything up so I thought I was ready to... (2 Replies)
Discussion started by: Alpha_Harblo
2 Replies

10. UNIX for Dummies Questions & Answers

Mac OSX question

Hi. Is it possible to execute a Cocoa (or Carbon or eaven a classic) program for mac OSX in the terminal window? OSX finder can sometimes be so busy that it wont respond for several minutes, ie if you are uploading a very big file/files to a afp server. Then it would have been nice to start... (7 Replies)
Discussion started by: nicke30
7 Replies
Login or Register to Ask a Question