We help IT Professionals succeed at work.

Cron Tabs Variable with OSX 10.6.4 server

amarks_ny
amarks_ny asked
on
Medium Priority
902 Views
Last Modified: 2013-11-11
I am trying to set up a cron job on OSX Server. I need to running this script at 5 am to run an import on 4 watched folders.  i need to trigger this 4 times with a different command

such as ./myimportscript2Xml.sh co

Import script
00     5       *       *       * /usr/local/scripts/myimportscript2Xml.sh



so is this correct or should I specify the full path of the script.

Import script
00     5       *       *       * /usr/local/scripts/myimportscript2Xml.sh "co"

o
Comment
Watch Question


Insufficient information.
Please define "trigger this 4 times with a different command" and "should I specify the full path of the script" .

Author

Commented:
would my crontab be this?

my variables are co, br, mx, and ar.


Import script
00     5       *       *       * /usr/local/scripts/myimportscript2Xml.sh "co"

00     5       *       *       * /usr/local/scripts/myimportscript2Xml.sh "br"

00     5       *       *       * /usr/local/scripts/myimportscript2Xml.sh "mx"

00     5       *       *       * /usr/local/scripts/myimportscript2Xml.sh "ar"

Commented:
Don't use cron at all, which is deprecated in OS X. Use launchd, which is more powerful and can be configured with a GUI application named lingon.

Author

Commented:
Ok, is my syntax correct?
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION
Now, you could also code one scripts to do all:
Crontab entry:
00     5       *       *       * /usr/local/scripts/myimportscript0Xml.sh
Script:

#!/bin/ksh
for v in co br mx ar
do
  /usr/local/scripts/myimportscript2Xml.sh $v
done

Open in new window

Author

Commented:
Yes, I suggested doing that as one script,

I was overruled in this instance.

Thank you for the input.
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.