Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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 should convert this cronjob to a launchctl plist.

Is this possible?

0 8-18 * * 1-5 /usr/bin/curl -s --data "par1=a&par2=b&press=OK" /dev/null
share|improve this question

Basically you could save a property list like this as ~/Libary/LaunchAgents/com.superuser.408777.plist, and load it with launchctl load ~/Libary/LaunchAgents/com.superuser.408777.plist or by logging out and back in.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC -//Apple Computer//DTD PLIST 1.0//EN >
<plist version="1.0">
<!--    <key>Program</key>
    <string>/absolute/path/to/script</string> -->
<!--    <key>StartInterval</key>
    <integer>3600</integer> --> this would just run the program arguments every hour

As far as I know, it's not possible to specify date ranges like hours 8-18 and days 1-5, other than listing each combination individually. You could run an external script every hour and exit it depending on the date though.

weekday=$(date +%w)
hour=$(date +%H)
[[ $weekday -le 0 || $weekday -ge 6 || $hour -le 7 || $hour -ge 19 ]] && exit
curl -s --data "par1=a&par2=b&press=OK" /dev/null
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.