User Name
Password
AppleNova Forums » Programmer's Nook »

launchd help needed.


Register Members List Calendar Search FAQ Posting Guidelines
launchd help needed.
Thread Tools
turtle
Lord of the Rant.
Formerly turtle2472
 
Join Date: Mar 2005
Location: Upstate South Carolina
 
2011-11-29, 12:00

So I was planning on configuring a cron job but have been looking into it and seems Apple doesn't like cron anymore and wasn't LaunchDaemons to be used instead. So I went from a cron job to a plist file. It doesn't seem to be working though. Am I missing something?
makemcmap10.plist
Code:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Label</key> <string>makemap.command</string> <key>UserName</key> <string>Tony</string> <key>Program</key> <string>/Users/Tony/Dropbox/minecraft/Tectonicus/makemap.command</string> <key>StartCalendarInterval</key> <dict> <key>Minute</key> <integer>1</integer> <key>Hour</key> <integer>10</integer> </dict> <key>Debug</key> <false/> <key>AbandonProcessGroup</key> <true/> </dict> </plist>
So the .command file is a bash script that I normally run by manually clicking. Should I change this to .sh for the sake of this launchd process? What am I missing?

What I really want is the script to run every 6 hours at 3,9,15,21.

Louis L'Amour, “To make democracy work, we must be a nation of participants, not simply observers. One who does not vote has no right to complain.”
Visit our archived Minecraft world! | Maybe someday I'll proof read, until then deal with it.
  quote
chucker
 
Join Date: May 2004
Location: near Bremen, Germany
Send a message via ICQ to chucker Send a message via AIM to chucker Send a message via MSN to chucker Send a message via Yahoo to chucker Send a message via Skype™ to chucker 
2011-11-29, 12:30

How did you load it?
  quote
turtle
Lord of the Rant.
Formerly turtle2472
 
Join Date: Mar 2005
Location: Upstate South Carolina
 
2011-11-29, 13:09

Quote:
Originally Posted by chucker View Post
How did you load it?
Well, your question made me think.

I stuck it in the LaunchDaemons folder.

I didn't reboot or anything that would initiate the system to look at it or load it for later running. Are you thinking this is my problem?

Also, how about making it run 4 times a day.

Louis L'Amour, “To make democracy work, we must be a nation of participants, not simply observers. One who does not vote has no right to complain.”
Visit our archived Minecraft world! | Maybe someday I'll proof read, until then deal with it.
  quote
chucker
 
Join Date: May 2004
Location: near Bremen, Germany
Send a message via ICQ to chucker Send a message via AIM to chucker Send a message via MSN to chucker Send a message via Yahoo to chucker Send a message via Skype™ to chucker 
2011-11-29, 13:58

Use 'launchctl load -w filenamegoeshere'. The -w marks it as permanently enabled (rather than loaded as a one-shot thing).

To run it 4 times a day, get rid of the StartCalendarInterval and instead set the StartInterval to 21600 (seconds in a fourth of a day).
  quote
turtle
Lord of the Rant.
Formerly turtle2472
 
Join Date: Mar 2005
Location: Upstate South Carolina
 
2011-11-29, 22:00

Made the change and loaded per your command. I'll let you know how it turns out. I have my script make log entries so I can see what makes it through and what fails.

So, when are you going to finally join us in Minecraft?

Louis L'Amour, “To make democracy work, we must be a nation of participants, not simply observers. One who does not vote has no right to complain.”
Visit our archived Minecraft world! | Maybe someday I'll proof read, until then deal with it.
  quote
chucker
 
Join Date: May 2004
Location: near Bremen, Germany
Send a message via ICQ to chucker Send a message via AIM to chucker Send a message via MSN to chucker Send a message via Yahoo to chucker Send a message via Skype™ to chucker 
2011-11-30, 01:02

As I'm sure Capella will attest to, the last thing I need right now is another addiction.
  quote
turtle
Lord of the Rant.
Formerly turtle2472
 
Join Date: Mar 2005
Location: Upstate South Carolina
 
2011-11-30, 10:41

So this is what I now have:
Code:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Label</key> <string>makemap.command</string> <key>UserName</key> <string>Tony</string> <key>Program</key> <string>/Users/Tony/Dropbox/minecraft/Tectonicus/makemap.command</string> <key>StartInterval</key> <integer>21600</integer> <key>Debug</key> <false/> <key>AbandonProcessGroup</key> <true/> </dict> </plist>
I ran the command as you said and it's working great! Thank you very much for you help chucker.

But it's sooooo good chucker. You can stop any time.

Louis L'Amour, “To make democracy work, we must be a nation of participants, not simply observers. One who does not vote has no right to complain.”
Visit our archived Minecraft world! | Maybe someday I'll proof read, until then deal with it.
  quote
chucker
 
Join Date: May 2004
Location: near Bremen, Germany
Send a message via ICQ to chucker Send a message via AIM to chucker Send a message via MSN to chucker Send a message via Yahoo to chucker Send a message via Skype™ to chucker 
2011-11-30, 11:30

Quote:
Originally Posted by turtle View Post
You can stop any time.


Glad to have helped.
  quote
turtle
Lord of the Rant.
Formerly turtle2472
 
Join Date: Mar 2005
Location: Upstate South Carolina
 
2012-06-05, 21:43

So I modified the plist again because the vote was to make it only run twice a day rather than the four times a day. My plist is now this as given by a code generator site:
Code:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Label</key> <string>makemcmap.plist</string> <key>UserName</key> <string>Tony</string> <key>Program</key> <string>/Volumes/Closet/Dropbox/mc/Tectonicus/makemap.command</string> <key>StartCalendarInterval</key> <array> <dict> <key>Hour</key> <integer>3</integer> </dict> <dict> <key>Hour</key> <integer>15</integer> </dict> </array> </dict> </plist>
Thing is for some reason it's running four times still.

Excerpt from my logs:
Code:
******************* Beginning Process ******************* Tue Jun 5 03:00:09 EDT 2012 Backup Script Started, Tue Jun 5 03:00:09 EDT 2012 Backup Script Completed, Tue Jun 5 03:00:23 EDT 2012 Getting backup, Tue Jun 5 03:00:23 EDT 2012 Backup world.tgz downloaded, Tue Jun 5 03:00:39 EDT 2012 Expanding world files, Tue Jun 5 03:00:39 EDT 2012 World files expanded, Tue Jun 5 03:00:49 EDT 2012 Tectnoicus Generation Started, Tue Jun 5 03:00:49 EDT 2012 Tectnoicus Generation Completed, Tue Jun 5 04:43:49 EDT 2012 Starting to copy map components to server, Tue Jun 5 04:43:49 EDT 2012 Maint index.html copied to server, Tue Jun 5 04:43:50 EDT 2012 Images copied to server, Tue Jun 5 04:43:51 EDT 2012 Scripts copied to server, Tue Jun 5 04:43:51 EDT 2012 Starting to copy map data to server, Tue Jun 5 04:43:51 EDT 2012 Maps copied to server, Tue Jun 5 05:53:34 EDT 2012 Active index.html copied to server, Tue Jun 5 05:53:34 EDT 2012 Maps back online, Tue Jun 5 05:53:34 EDT 2012 rsync exchange completed, Tue Jun 5 05:53:34 EDT 2012 Removed expanded world dir, Tue Jun 5 05:53:34 EDT 2012 ******************* Completed Process ******************* Tue Jun 5 05:53:34 EDT 2012 ******************* Beginning Process ******************* Tue Jun 5 05:53:34 EDT 2012 Backup Script Started, Tue Jun 5 05:53:34 EDT 2012 Backup Script Completed, Tue Jun 5 05:53:49 EDT 2012 Getting backup, Tue Jun 5 05:53:49 EDT 2012 Backup world.tgz downloaded, Tue Jun 5 05:54:05 EDT 2012 Expanding world files, Tue Jun 5 05:54:05 EDT 2012 World files expanded, Tue Jun 5 05:54:15 EDT 2012 Tectnoicus Generation Started, Tue Jun 5 05:54:15 EDT 2012 Tectnoicus Generation Completed, Tue Jun 5 07:00:04 EDT 2012 Starting to copy map components to server, Tue Jun 5 07:00:04 EDT 2012 Maint index.html copied to server, Tue Jun 5 07:00:04 EDT 2012 Images copied to server, Tue Jun 5 07:00:05 EDT 2012 Scripts copied to server, Tue Jun 5 07:00:05 EDT 2012 Starting to copy map data to server, Tue Jun 5 07:00:05 EDT 2012 Maps copied to server, Tue Jun 5 07:49:57 EDT 2012 Active index.html copied to server, Tue Jun 5 07:49:57 EDT 2012 Maps back online, Tue Jun 5 07:49:57 EDT 2012 rsync exchange completed, Tue Jun 5 07:49:57 EDT 2012 Removed expanded world dir, Tue Jun 5 07:49:58 EDT 2012 ******************* Completed Process ******************* Tue Jun 5 07:49:58 EDT 2012 ******************* Beginning Process ******************* Tue Jun 5 15:00:00 EDT 2012 Backup Script Started, Tue Jun 5 15:00:00 EDT 2012 Backup Script Completed, Tue Jun 5 15:00:14 EDT 2012 Getting backup, Tue Jun 5 15:00:14 EDT 2012 Backup world.tgz downloaded, Tue Jun 5 15:00:30 EDT 2012 Expanding world files, Tue Jun 5 15:00:30 EDT 2012 World files expanded, Tue Jun 5 15:00:40 EDT 2012 Tectnoicus Generation Started, Tue Jun 5 15:00:40 EDT 2012 Tectnoicus Generation Completed, Tue Jun 5 16:18:50 EDT 2012 Starting to copy map components to server, Tue Jun 5 16:18:50 EDT 2012 Maint index.html copied to server, Tue Jun 5 16:18:51 EDT 2012 Images copied to server, Tue Jun 5 16:18:51 EDT 2012 Scripts copied to server, Tue Jun 5 16:18:52 EDT 2012 Starting to copy map data to server, Tue Jun 5 16:18:52 EDT 2012 Maps copied to server, Tue Jun 5 17:23:22 EDT 2012 Active index.html copied to server, Tue Jun 5 17:23:22 EDT 2012 Maps back online, Tue Jun 5 17:23:22 EDT 2012 rsync exchange completed, Tue Jun 5 17:23:22 EDT 2012 Removed expanded world dir, Tue Jun 5 17:23:22 EDT 2012 ******************* Completed Process ******************* Tue Jun 5 17:23:22 EDT 2012 ******************* Beginning Process ******************* Tue Jun 5 17:23:22 EDT 2012 Backup Script Started, Tue Jun 5 17:23:22 EDT 2012 Backup Script Completed, Tue Jun 5 17:23:36 EDT 2012 Getting backup, Tue Jun 5 17:23:36 EDT 2012 Backup world.tgz downloaded, Tue Jun 5 17:23:50 EDT 2012 Expanding world files, Tue Jun 5 17:23:50 EDT 2012 World files expanded, Tue Jun 5 17:24:05 EDT 2012 Tectnoicus Generation Started, Tue Jun 5 17:24:05 EDT 2012 Tectnoicus Generation Completed, Tue Jun 5 18:27:47 EDT 2012 Starting to copy map components to server, Tue Jun 5 18:27:47 EDT 2012 Maint index.html copied to server, Tue Jun 5 18:27:47 EDT 2012 Images copied to server, Tue Jun 5 18:27:48 EDT 2012 Scripts copied to server, Tue Jun 5 18:27:48 EDT 2012 Starting to copy map data to server, Tue Jun 5 18:27:48 EDT 2012 Maps copied to server, Tue Jun 5 19:26:07 EDT 2012 Active index.html copied to server, Tue Jun 5 19:26:07 EDT 2012 Maps back online, Tue Jun 5 19:26:07 EDT 2012 rsync exchange completed, Tue Jun 5 19:26:07 EDT 2012 Removed expanded world dir, Tue Jun 5 19:26:07 EDT 2012 ******************* Completed Process ******************* Tue Jun 5 19:26:07 EDT 2012
So as you can see, it run the process right on schedule for the 3am and 3pm but then runs it again right after each one runs. Is there some command I'm missing from my code?

Also, with launchd, is there a way I can make it so I don't have to reload after each reboot of the machine? As it is now, if the machine reboots I have to manually reload the plist.

Louis L'Amour, “To make democracy work, we must be a nation of participants, not simply observers. One who does not vote has no right to complain.”
Visit our archived Minecraft world! | Maybe someday I'll proof read, until then deal with it.
  quote
Posting Rules Navigation
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Post Reply

Forum Jump
Thread Tools
Similar Threads
Thread Thread Starter Forum Replies Last Post
CSS help needed torifile Programmer's Nook 12 2008-09-25 17:37
Apple Opens Up: Kernel, Mac OS Forge, iCal Server, Bonjour, Launchd scratt Programmer's Nook 12 2006-08-09 23:18
iMac G5 help needed please Jeepin4Him Genius Bar 3 2006-08-07 13:41
caption needed... Paul General Discussion 1 2005-03-27 08:10
Needed Ram MacDude15 Apple Products 10 2005-01-22 23:51


« Previous Thread | Next Thread »

All times are GMT -5. The time now is 14:40.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004 - 2024, AppleNova