Launchctl ignores parameters in given launchd.plist, doesn't pass arguments

*Here's my plist:*
<?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>Debug</key>
<true/>
<key>ExitTimeOut</key>
<integer>0</integer>
<key>GroupName</key>
<string>wheel</string>
<key>KeepAlive</key>
<false/>
<key>Label</key>
<string>org.earlywine.backup.toDMG</string>
<key>LowPriorityIO</key>
<false/>
<key>Program</key>
<string>/usr/share/org.earlywine.backup/toDMG/Backup.bash</string>
<key>ProgramArguments</key>
<array>
<string>/Volumes/Home</string>
<string>/Volums/Backup/Backups</string>
</array>
<key>RunAtLoad</key>
<false/>
<key>StandardErrorPath</key>
<string>/Library/Logs/org.earlywine.backup.toDMG/stderr.txt</string>
<key>StandardOutPath</key>
<string>/Library/Logs/org.earlywine.backup.toDMG/stdout.txt</string>
<key>TimeOut</key>
<integer>0</integer>
<key>UserName</key>
<string>root</string>
<key>WorkingDirectory</key>
<string>/usr/share/org.earlywine.backup/toDMG</string>
</dict>
</plist>
*Launchctl fails to honor parameters given to it in the plist.* Specifically, as an administrator, when running sudo launchctl, then giving it the load command and following it up with a list for the job label, here's what I'm shown:
launchd% list org.earlywine.backup.toDMG
"Label" = "org.earlywine.backup.toDMG";
"LimitLoadToSessionType" = "System";
"OnDemand" = true;
"LastExitStatus" = 0;
"TimeOut" = 0;
"Program" = "/usr/share/org.earlywine.backup/toDMG/Backup.bash";
"StandardOutPath" = "/Library/Logs/org.earlywine.backup.toDMG/stdout.txt";
"StandardErrorPath" = "/Library/Logs/org.earlywine.backup.toDMG/stderr.txt";
"ProgramArguments" = (
"/Volumes/Home";
"/Volums/Backup/Backups";
It's not clear at all based upon the man pages why the following arguments in the plist are not shown: Debug, GroupName, UserName, ExitTimeOut, LowPriorityIO, and WorkingDirectory.
I can confirm, that as a regular user, after loading and starting the jog, Console logs that the GroupName and UserName properties are ignored (documented in the man page). This is expected, and results in errors when the stdout and stderr files are attempted to be opened.
*When started from any user's launchctl session, the script exits as though it wasn't given arguments.* This is evidenced by the usage() I have it print to stderr. The script checks to see if it was given 2 or more parameters, and if not, prints the usage and exits.
I'm sure the script works properly - I've given myself sudoers rights to the Bash script, and can run it by hand without issue, as in:
% sudo /usr/share/org.earlywine.backup/toDMG/Backup.bash /Volumes/Home /Volumes/Backup/Backups
The plist is symlinked at /Library/LaunchDaemons/org.earlywine.backup.toDMG.plist and is in the launchctl list when an administrator sudo's into a launchctl session.
*Behavior via the rc.shutdown.local script doesn't even equal that of a sudo'd launchctl session.*
Here's my rc.shutdown.local script:
#!/bin/bash
launchctl start org.earlywine.backup.toDMG
*Console logs the following as a result of the shutdown:*
Nov 17 21:06:19 Tiznit com.apple.SystemStarter[39]: org.earlywine.backup.toDMG: Invalid argument
Nov 17 21:06:19 Tiznit com.apple.SystemStarter[39]: launchctl start error: No such process
Nov 17 21:06:19 Tiznit SystemStarter[39]: /bin/sh exit status: 1
Based upon that message, I'd say that launchctl doesn't have the job loaded start. Despite that hunch, inserting into the shutdown script "launchctl load ..." in the line above the start makes no difference.
The manual pages for SystemStarter and launchd do not discuss the operating environment of SystemStarter and the resulting bash script that it runs.
It would be great if I could get some assistance with this, even though I'm running Leopard on an "unsupported" Mac.

I suggest posting to the Unix forum under OS X Technologies.

Similar Messages

  • Launchctl ignores parameters in given launchd.plist, doesn't pass argument

    *Here's my plist:*
    <?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>Debug</key>
    <true/>
    <key>ExitTimeOut</key>
    <integer>0</integer>
    <key>GroupName</key>
    <string>wheel</string>
    <key>KeepAlive</key>
    <false/>
    <key>Label</key>
    <string>org.earlywine.backup.toDMG</string>
    <key>LowPriorityIO</key>
    <false/>
    <key>Program</key>
    <string>/usr/share/org.earlywine.backup/toDMG/Backup.bash</string>
    <key>ProgramArguments</key>
    <array>
    <string>/Volumes/Home</string>
    <string>/Volums/Backup/Backups</string>
    </array>
    <key>RunAtLoad</key>
    <false/>
    <key>StandardErrorPath</key>
    <string>/Library/Logs/org.earlywine.backup.toDMG/stderr.txt</string>
    <key>StandardOutPath</key>
    <string>/Library/Logs/org.earlywine.backup.toDMG/stdout.txt</string>
    <key>TimeOut</key>
    <integer>0</integer>
    <key>UserName</key>
    <string>root</string>
    <key>WorkingDirectory</key>
    <string>/usr/share/org.earlywine.backup/toDMG</string>
    </dict>
    </plist>
    *Launchctl fails to honor parameters given to it in the plist.* Specifically, as an administrator, when running sudo launchctl, then giving it the load command and following it up with a list for the job label, here's what I'm shown:
    launchd% list org.earlywine.backup.toDMG
    "Label" = "org.earlywine.backup.toDMG";
    "LimitLoadToSessionType" = "System";
    "OnDemand" = true;
    "LastExitStatus" = 0;
    "TimeOut" = 0;
    "Program" = "/usr/share/org.earlywine.backup/toDMG/Backup.bash";
    "StandardOutPath" = "/Library/Logs/org.earlywine.backup.toDMG/stdout.txt";
    "StandardErrorPath" = "/Library/Logs/org.earlywine.backup.toDMG/stderr.txt";
    "ProgramArguments" = (
    "/Volumes/Home";
    "/Volums/Backup/Backups";
    *It's not clear at all based upon the man pages why the following arguments in the plist are not shown*: Debug, GroupName, UserName, ExitTimeOut, LowPriorityIO, and WorkingDirectory.
    I can confirm, that as a regular user, after loading and starting the jog, Console logs that the GroupName and UserName properties are ignored (documented in the man page). This is expected, and results in errors when the stdout and stderr files are attempted to be opened.
    *When started from any user's launchctl session, the script exits as though it wasn't given arguments.* This is evidenced by the usage() I have it print to stderr. The script checks to see if it was given 2 or more parameters, and if not, prints the usage and exits.
    I'm sure the script works properly - I've given myself sudoers rights to the Bash script, and can run it by hand without issue, as in:
    % sudo /usr/share/org.earlywine.backup/toDMG/Backup.bash /Volumes/Home /Volumes/Backup/Backups
    The plist is symlinked at /Library/LaunchDaemons/org.earlywine.backup.toDMG.plist and is in the launchctl list when an administrator sudo's into a launchctl session.
    *Behavior via the rc.shutdown.local script doesn't even equal that of a sudo'd launchctl session.*
    Here's my rc.shutdown.local script:
    #!/bin/bash
    launchctl start org.earlywine.backup.toDMG
    Console logs the following as a result of the shutdown:
    Nov 17 21:06:19 Tiznit com.apple.SystemStarter39: org.earlywine.backup.toDMG: Invalid argument
    Nov 17 21:06:19 Tiznit com.apple.SystemStarter39: launchctl start error: No such process
    Nov 17 21:06:19 Tiznit SystemStarter39: /bin/sh exit status: 1
    Based upon that message, I'd say that launchctl doesn't have the job loaded start. Despite that hunch, inserting into the shutdown script "launchctl load ..." in the line above the start makes no difference.
    The manual pages for SystemStarter and launchd do not discuss the operating environment of SystemStarter and the resulting bash script that it runs.
    It would be great if I could get some assistance with this, even though I'm running Leopard on an "unsupported" Mac.

    etresoft wrote:
    The manual pages for SystemStarter and launchd do not discuss the operating environment of SystemStarter and the resulting bash script that it runs.
    What do you mean "bash script?" Are you talking about your own bash script? It would run with the user's environment. You usually don't want to rely on environment settings in system scripts like this. If you need something, you specify it on the command line. If you run another program, you provide the full path to it.
    By "the resulting bash script that it runs", I mean the fact that SystemStarter looks for the file /etc/rc.shutdown.local and executes it during shutdown (see SystemStarter's Plist and this source lines 166-170).
    The rc.shutdown.local file, as I created it, is a bash script.
    A regular user can't make launchd run as root. If you want to run as root, remove the GroupName and UserName and run launchd as root.
    My initial reason for having UserName and GroupName in the plist was so that I could ensure the job ran as root. I know now that in order to do this the job must be started by a root-owned launchd.
    My own user is not an administrator, and the script needs root privileges in order to do its job properly. I may be able to start the job as such from my own launchd via launchctl if I prefixed the script name with "sudo" in the plist.
    I now know the UserName and GroupName plist options are not necessary to run the job as root during shutdown.
    I'm sure the script works properly - I've given myself sudoers rights to the Bash script, and can run it by hand without issue, as in:
    What does that mean? When you run a program with sudo, it just runs the program as root. There are lots more way to configure sudo in sudo's config file, but I don't think you are talking about that.
    I mean that the Bash script runs properly if run it by hand in the terminal, feeding it the arguments in bash. I was trying to imply that if it's given the arguments it will do its job.
    I was also trying to point out that the plist I gave launchctl didn't effect the same as running the script via Terminal. This even when running "sudo launchctl" and loading and starting the job, which would've been done as root.
    Given Jun T.'s response to ProgramArguments (thanks), the script will probably run on shutdown if I remove Program from the plist and move it to ProgramArguments as the first entry in the String array.

  • Script inside launchd plist

    Hi,
    playing with lauchd plists to get some feeling about how certain things works I came up with this script inside the plist
    <key>ProgramArguments</key>
    <array>
    <string>/bin/sh</string>
    <string>-c</string>
    <string>/bin/df -k| /usr/bin/grep /dev/ | /usr/bin/awk '{ OFS="     "; "date +%d-%b-%Y-%I:%M| getline; print $6, $1, $4, $5;}'</string>
    </array>
    Its close to what I try to do in my trial stage one (1), but see some unwanted and unexpected issues
    1. why is there a tab at the first line?
    2. Where is the first Item, is it replaced with the date or just ignored?
    3. Should I see the result(s) of date as a multi word? If I keep a space between +%d-%b-%Y and %I:%M i get a wrong result.
    *this is what I get*
    29-May-2010-10:53
    /Volumes/TimeMachine /dev/disk5s3 303667180 69%
    /Volumes/RAID01 /dev/disk4 55598552 93%
    /Volumes/Repository /dev/disk0s3 96066032 2%
    /Volumes/Data /dev/disk0s4 506853520 40%
    /Volumes/Applications /dev/disk1s4 11657776 73%
    *This what I actually did expect with the current script ( not what I want );*
    29-May-2010-10:53 / /dev/disk1s3 16190024 62%
    29-May-2010-10:53 /Volumes/TimeMachine /dev/disk5s3 303667180 69%
    29-May-2010-10:53 /Volumes/RAID01 /dev/disk4 55598552 93%
    29-May-2010-10:53 /Volumes/Repository /dev/disk0s3 96066032 2%
    29-May-2010-10:53 /Volumes/Data /dev/disk0s4 506853520 40%
    29-May-2010-10:53 /Volumes/Applications /dev/disk1s4 11657776 73%
    I thought that the date line will get printed every time for each line from the previous piped command
    *This is what I want ( stage 1 )*
    29-May-2010 10:53
    / /dev/disk1s3 16190024 62%
    /Volumes/TimeMachine /dev/disk5s3 303667180 69%
    /Volumes/RAID01 /dev/disk4 55598552 93%
    /Volumes/Repository /dev/disk0s3 96066032 2%
    /Volumes/Data /dev/disk0s4 506853520 40%
    /Volumes/Applications /dev/disk 1s4 11657776 73%
    *This is what I finally want ( stage 2 )*
    29-May-2010 10:53
    / 1s3 16190024 62%
    TimeMachine 5s3 303667180 69%
    RAID01 4 55598552 93%
    Repository 0s3 96066032 2%
    Data 0s4 506853520 40%
    Applications 1s4 11657776 73%
    Any help or ideas are welcome.
    Thanks
    PS.
    Here the total launchd plist script for copy>test ( check output path )
    <?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>Debug</key>
    <true/>
    <key>InitGroups</key>
    <false/>
    <key>Label</key>
    <string>net.test.PlayWithMeScript2</string>
    <key>LowPriorityIO</key>
    <true/>
    <key>ProgramArguments</key>
    <array>
    <string>/bin/sh</string>
    <string>-c</string>
    <string>/bin/df -k| /usr/bin/grep /dev/ | /usr/bin/awk '{ OFS="     "; "date+%d-%b-%Y-%I:%M"| getline; print $6, $1, $4, $5;}'</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
    <key>ServiceDescription</key>
    <string>Play With me script</string>
    <key>StandardOutPath</key>
    <string>/Volumes/TestBedDevelopment/TestLogs/log3.txt</string>
    <key>StartInterval</key>
    <integer>60</integer>
    <key>WorkingDirectory</key>
    <string>/</string>
    </dict>
    </plist>

    Absolutely true, but to learn the effects of the shell created by the launchd and a comment somewhere on the web about "if it can in launchd do it there" and that I dont want to install to much, I choose for this, for now.
    Then, with all due respect to whoever wrote that article, he's an idiot
    Launchd has many uses, but it's not the right place to put a multi-step script with umpteen pipes and dependencies.
    Besides, I'm actually surprised it even remotely works, since launchd normally requires each element in the command to be in a separate <ProgramArguments> array element. In other words, your original:
    <key>ProgramArguments</key>
    <array>
    <string>/bin/sh</string>
    <string>-c</string>
    <string>/bin/df -k| /usr/bin/grep /dev/ | /usr/bin/awk '{ OFS="\t"; "date+%d-%b-%Y-%I:%M"| getline; print $6, $1, $4, $5;}'</string>
    </array>
    should really be more like:
    <key>ProgramArguments</key>
    <array>
    <string>/bin/sh</string>
    <string>-c</string>
    <string>/bin/df</string>
    <string>-k</string>
    <string>|</string>
    <string>/usr/bin/grep</string>
    <string>/dev/</string>
    <string>|</string>
    <string>/usr/bin/awk</string>
    <string>'{</string>
    <string>OFS="\t";</string>
    <string>"date+%d-%b-%Y-%I:%M"</string>
    <string>|</string>
    <string>getline;</string>
    <string>print</string>
    <string>$6,</string>
    <string>$1,</string>
    <string>$4,</string>
    <string>$5;}'</string>
    </array>
    and now you can see why it's a really, really bad idea to do. Far easier to just:
    <key>ProgramArguments</key>
    <array>
    <string>/usr/local/bin/myscript.sh</string>
    </array>
    and put all the logic in a separate file.
    The first line is gone because you're using getline within your awk statement, which tells awk to skip to the next line.
    I did hoped that didn't effect everything after the ;
    No. As per man awk:
    The ``function'' getline sets $0 to the next input record from the current input file;
    so getline moves onto the next line.
    How can I return a value from a launchd?
    What do you mean 'return a value from launchd'? You don't normally interact with launchd, so getting a return value from it doesn't make much sense.
    And why does my script keep running?
    because that's what launchd is for. By default, launchd is tasked with launching a process and keeping it running. So if a process fails it automatically gets restarted. This is normally what you want for system-level processes.
    Now, that said, launchd has a number of variations that you can use to tell it to launch processes at specific times, or when certain events happen, or only at boot time, etc., but you need to add them to your .plist so that launchd knows when (and when not) to launch/restart your process.

  • Launchd .plist breaks when periodic daily runs

    Why does my launchd .plist break when periodic daily runs?
    I wrote a script basically like this
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
    <key>GroupName</key>
    <string>wheel</string>
    <key>Label</key>
    <string>MacPeter.thingy</string>
    <key>Program</key>
    <string>/usr/local/sbin/my_script</string>
    <key>ProgramArguments</key>
    <array>
    <string>/usr/local/sbin/my_script</string>
    </array>
    <key>StandardErrorPath</key>
    <string>/dev/null</string>
    <key>StandardOutPath</key>
    <string>/var/log/myotherlog.log</string>
    <key>UserName</key>
    <string>root</string>
    <key>WatchPaths</key>
    <array>
    <string>/var/log/my_log.log</string>
    </array>
    </dict>
    </plist>
    I had to do some of this at the command line with sudo to get this .plist file into /Library/LaunchAgents and launch it. The idea is that watches the log file
    my_log.log (which I have created) and when there is activity on this log file it runs my_script, outputting the results to myotherlog.log.
    In order to avoid my_log simply growing unmanageably I also modified the /etc/daily file to add my_log to the list of logs which are rotated daily at 3:15 a.m. At 3.15, periodic daily runs, it moves and gzips my_log.log to my_log.log.0.gz and it creates a fresh my_log.log using touch.
    At this point my .plist remains loaded but stops working: it nolonger watches the new my_log.log.
    As a workaround I have put the following lines in /etc/daily.local:
    launchctl unload /Library/LaunchAgents/MacPeter.thingy.plist
    launchctl load /Library/LaunchAgents/MacPeter.thingy.plist
    This solves the problem. My question:
    Is my workaround really necessary or am I missing some other point about
    using launchd and .plist files?
    G5 single processor   Mac OS X (10.4)  

    Just as a quick guess, I would say that nothing actually breaks, you just need to keep in mind that if you roll the log you need to also reopen the file handle that points to the log file. If you don't reopen the file it will continue to look at the old, possible unlinked file pointer until the process is restarted.
    Not having much to do with launchd I would assume that this is what is happening. You need to get it to reopen the log file after is it rolled.
    Seeya...Q

  • Truly required keys in launchd plist file

    I am trying to get a launchd plist to work and run all the time. I want it to shut down my Mail.app on a certain day of the week (when I am not there). Of course, I want another one to turn it on when I get in the next day. The only plist keys that are supposed to be required are the Label and ProgramArguments. However, unless I also add the StartInterval key (any setting), my script is never called in the first place. (I have not tried any other keys yet, I am still testing this thing out.)
    Without the StartInterval, the launchctl list still shows the correct plist file is running, but Mail never shuts down. I get this on the command line:
    Workaround Bonjour: Unknown error: 0
    I tried looking into the launchctl log, and it is empty as well.
    Is this a bug, or is it necessary after all to have either StartInterval or StartCalendarInterval keyed in any launchd plist for it to function?
    I appreciate any and all feedback.

    No replies - Have mostly solved through trial and error.

  • Launchd.plist quandry

    Per an earlier post, I finally got Snort® NIDS v2.8.3 compiled, installed, and configured on my Mac Pro running OS 10.5.4. It runs fine if invoked from the keyboard, in either daemon mode or non-daemon mode. I am having problems with launching it via launchd.plist, though, and am hoping that someone can look at my plist with a fresh set of eyes and perhaps be able to immediately tell me why snort isn't launching at computer bootup.
    I want to launch an occurrence of Snort in daemon mode via launchd at bootup. The command that I use to invoke Snort in daemon mode from Terminal's command line is:
      /usr/local/bin/snort -DdevI -i en2 -l /var/log/snort/ -c /usr/local/snort-2.8.3/etc/snort.conf
    This command works fine from Terminal's command line, and launches snort in daemon mode, when root.
    My /Library/LaunchDaemons/snort.plist is:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
    "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
    <key>Label</key>
    <string>snort</string>
    <key>ServiceDescription</key>
    <string>launch SNORT® network intrusion detection system at bootup</string>
    <key>ProgramArguments</key>
    <array>
    <string>/usr/local/bin/snort</string>
    <string>-DdevI</string>
    <string>-i en2</string>
    <string>-l /var/log/snort/</string>
    <string>-c /usr/local/snort-2.8.3/etc/snort.conf</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
    </dict>
    </plist> 
    Other info of interest:
    -rwxr-xr-x 1 root wheel /usr/local/bin/snort
    -rw-r--r-- 1 root wheel /usr/local/snort-2.8.3/snort.plist
    lrwxr-xr-x 1 root wheel /Library/LaunchDaemons/snort.plist -> /usr/local/snort-2.8.3/snort.plist 
    (Note: It is common practice of mine to keep my homebrew launchd plists with the scripts or binaries themselves, and put sym links in /Library/LaunchDaemons/ or ~/Library/LaunchAgents/)
    Thanx, anybody, in advance for any help that you can provide.

    1. You should get rid of the "®" in your plist for reasons both legal and syntactic--the Snort logo is a registered trademark on the PTO's principal register, the word "snort" is not.
    It would seem that the ServiceDescription functionality, recognized in Tiger, is no longer recognized as a valid launchd.plist keyword in Leopard. The console log indicates that this is now an unrecognized key word -- in each and every one of my launchd items. That keyword, along with its string, was removed. It didn't help, however.
    2. You should not be symlinking anything.
    Symlinking launchd plists has never, ever caused me problems before, and I have probably a half dozen symlinked plists. But, in the interest of trying to get this to work properly, I rm'ed the symlink, and mv'ed the actual plist to /Library/LaunchDaemons. Didn't cure the problem, though.
    3. You should be using *launchctl load* for immediate feedback.
    Thanks for that. I can never remember that command name!
    4. You should read these cover-to-cover:
    http://developer.apple.com/macosx/launchd.html
    http://developer.apple.com/technotes/tn2005/tn2083.html
    OK - done - nothing there jumped out at me as problems with what I was doing, but, handy references to have lying around. I'm already practicing the convention discussed therein that non-user-specific, homebrew, faceless jobs should go in the /Library/LaunchDaemons folder, as would make sense for a NIDS. So I'm not sure if you had something specific in mind when citing these articles or not....

  • Launchd.plist not launching according to SetCalendarInterval

    I have created a launchd.plist that runs a shell script to connect to a remote server and back up some log files using rsync. I have configured it to run every 15 minutes, but it is running every 10 seconds. I can't figure out why. I have posted my XML to see if anyone can shed light as to why this is happening...
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
    <key>Disabled</key>
    <false/>
    <key>Label</key>
    <string>com.bgserver.logs</string>
    <key>LowPriorityIO</key>
    <true/>
    <key>Nice</key>
    <integer>12</integer>
    <key>OnDemand</key>
    <true/>
    <key>ProgramArguments</key>
    <array>
    <string>/Users/user/Documents/scripts/logs.sh</string>
    </array>
    <key>RunAtLoad</key>
    <false/>
    <key>StartCalendarInterval</key>
    <dict>
    <key>Minute</key>
    <integer>15</integer>
    </dict>
    </dict>
    </plist>
    Here is what the console is reporting...
    10/28/09 3:31:35 PM com.apple.launchd.peruser.501[140] (com.bgserver.logs) Throttling respawn: Will start in 10 seconds
    10/28/09 3:31:45 PM com.bgserver.logs[2067] receiving file list ...
    10/28/09 3:31:45 PM com.bgserver.logs[2067] done
    10/28/09 3:31:45 PM com.bgserver.logs[2067] sent 20 bytes received 6398 bytes 12836.00 bytes/sec
    10/28/09 3:31:45 PM com.bgserver.logs[2067] total size is 1008110615 speedup is 157075.51
    10/28/09 3:31:45 PM com.apple.launchd.peruser.501[140] (com.bgserver.logs) Throttling respawn: Will start in 10 seconds
    10/28/09 3:31:55 PM com.bgserver.logs[2071] receiving file list ...
    10/28/09 3:31:55 PM com.bgserver.logs[2071] done
    10/28/09 3:31:55 PM com.bgserver.logs[2071] sent 20 bytes received 6398 bytes 12836.00 bytes/sec
    10/28/09 3:31:55 PM com.bgserver.logs[2071] total size is 1008110615 speedup is 157075.51
    10/28/09 3:31:55 PM com.apple.launchd.peruser.501[140]
    Message was edited by: ScottMSEM
    Message was edited by: ScottMSEM
    Message was edited by: ScottMSEM

    Ok, I made the changes you mentioned, and now my plist looks like this....
    <?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>Disabled</key>
    <false/>
    <key>Label</key>
    <string>com.bgserver.logs</string>
    <key>LowPriorityIO</key>
    <true/>
    <key>Nice</key>
    <integer>12</integer>
    <key>Program</key>
    <array>
    <string>/Users/sford/Documents/scripts/logs.sh</string>
    </array>
    <key>RunAtLoad</key>
    <false/>
    <key>StartInterval</key>
    <integer>900</integer>
    </dict>
    </plist>
    When I type launchctl list I see com.bgserver.logs is working...
    - 0 com.bgserver.logs
    If I type launchctl start com.bgserver.logs, it runs perfectly. The script goes, and does what is expected. Then it never runs again...
    If I type launchctl list, I get the same message that it is working...
    - 0 com.bgserver.logs
    Here is my console report again...
    10/29/09 11:15:49 AM com.bgserver.logs[556] building file list ...
    10/29/09 11:15:49 AM com.bgserver.logs[556] done
    10/29/09 11:15:49 AM com.bgserver.logs[556] sent 940 bytes received 20 bytes 1920.00 bytes/sec
    10/29/09 11:15:49 AM com.bgserver.logs[556] total size is 231809 speedup is 241.47
    You can see it ran at 11:15:49 AM, so I expected it would run at 11:30:49 AM.
    Thanks!

  • Request for additional functionality of launchd.plist

    Currently, launchd isn't designed to be event-driven via the launchd.plist. To remove the burden from developers, and to make launchd actually useful (cool!) for system administrators, here's a list of useful event options that could be added to launchd.
    OnGUILogin, to launch jobs when a new GUI session starts, with options to specify Aqua or an X11 session.
    OnGUILogout, like OnGUILogin, to launch jobs when logout is done (optionally to wait until exit before loginwindow is shown), or when the Apple's rootless X11 application is given the Quit command.
    OnGUISession, to launch jobs when a user logs in via the loginwindow as a result of fast user switching.
    OnGUISessionSwtich, to launch jobs when a user switches away from his or her desktop as a result of OnGUISession being triggered, with options for the switched-to GUI session to wait to get to the desktop until the job exits.
    OnConsoleLogin, to launch jobs when login(1) is run via a console.
    OnConsoleExit, to launch jobs to completion before exit(1), well, exits.
    OnShutdown, to replace the functionality (or lack of) that SystemStarter provides by supporting the rc.shutdown.local script.
    OnVolumeMount, with options for specifying GUID, Volume Name, Mount Point, or Media Type (USB, CD, DVD), Device Node, or Bus, so that a process can launch as a result of any, or a specific, volume mounting.
    OnVolumeUnmount, like OnVolumeMount, with option to block umount from finishing so that a job can access the volume before it's gone
    OnVolumeEject, for responding to media ejects
    Properly, OnVolumeMount, OnVolumeDismount, and OnVolumeEject would have its plist published to the specified volume upon being run, and launchd would publish the current version before the media is unmounted.
    This way, a removable device may act as a source or destination repository of launchd jobs, across multiple machines. In a way, this makes the volume "intelligent", and can become self-aware.
    Imagine a flash drive that installs system updates via Installer on machines that need them. Or a CD that checks itself for integrity against a volume MD5 checksum when its inserted.
    Or better yet, a volume that uses Time Machine and asks for an update if its stale. Taking that idea further, imagine a flash drive, formatted as XFS (that Time Machine should use in the future), that takes snapshots of a user's files for instant get-away, gotta go situations where certain files are needed. Kind of like a Back-To-My-Mac via removable media. On top of that, publish a resource on the volume to make it a mobile standalone equivalent of Window's System Restore.
    Integrating this functionality for those three options with securityd's user-agent would allow a user to permit such programs to to run or not (and flag them safe as when Internet downloaded files are launched for the first time, or as when Application sandboxing signs the executable).
    I hope this interests the Apple developers that make launchd. It seems all too often Apple's administration tools could be taken so much further to make our Macs true delight.
    Hope you enjoyed reading.

    I see now that the "StartOnMount" option in the plist can respond to a volume mounting.
    After further reading the man page, trying to decipher the -S and -D options to launchtl, this is what I understand, some or all of which may be wrong:
    1. The Aqua session is created when a user initially logs in. Jobs can be sarted as a result via the RunAtLoad option.
    2. The LoginWindow session is created when a user returns to the login window. I wonder is this is triggered by Logout, Fast User Switching, and/or the Screen Saver methods.
    3. The Background, StandardIO, and System session types aren't defined beyond having their names mentioned in the manual.
    4. The -S option, in combination with the -D option, requires plists exist in the LaunchAgents folder, not the LaunchDaemons folder of the domain.
    5. The session option enables the "user" domain, which based upon the manual example probably means jobs defined in ~/Library/LaunchAgents/.
    As a response to (3) above, how does one create or manage the sessions?

  • Can someone give me an example of a very simple launchd.plist file that...

    Launches an agent and allows the agent general internet access?
    I have this simple plist but what happens is that launchd launches it and then kills it (abort) and then launches it again and does the same thing 10 times and quits. I have traced the 'action' that causes this. As soon as my app tries to get a socket and connect, it is killed.
    I did put in a socket thing in the launchd plist file, but then it seems that launchd answers the call, not the thing I want to, then my app gets stuck on a recv call thinking it has sent data to a server and is waiting for an answer which will never come.
    I do not know if they have these for macs (I am sure they do), but imagine a tool like ICQ or Instant Messenger. It loads when the user logs on, you have your contacts list, and it coordinates via some foreign server, although once a match is made direct connects to person you are chatting with.
    How would you launch an agent like that? I can't figure out the plist entries needed. I can either launch my app and have it get "locked" by a recv call cause launchd answered the connect, and accepted the send, or I can remove the socket stuff and get in this cycle of launches and aborts.
    A simple example would be of great help.

    An object is a good way to implement this. For the first, the object would look like this:
    var oT1 = {
        "5" : 0.1,
        "50" : 2,
        "75" : 6,
        "100" : 12
    To get the value associated with the 100 property, the code would look something like:
    var val = oT1["100"];
    The variable "val" would then contain the number 12.
    For the second, the value of each object property could be an array, something like:
    var oT2 = {
        "Debbie" : [5, 0, 16],
        "Carl" : [0, 20, 4],
        "Josh" : [2, 8, 19]
    To get the second item in the array for the "Josh" array, the code would look like:
    var val = oT2["Josh"][1];
    To get the last item in the "Debbie" array, you could do this:
    var val = oT2["Debbie"][2];
    Array indexes are zero-based, so the second item has an index of 1, third item is 2, etc..
    Good luck

  • Audit Trail Report Ignores Parameters From/To Date on EBS 12.0.6

    Hi All,
    One of our customers is not able to filter the data in "Audit Trail Report" based on date parameters.
    Is there any patch for this..
    EBS Version is 12.0.6
    I have found a note but it is related to 11i.
    Audit Trail Report Ignores Parameters Transacted By, From/To Date (Doc ID 364304.1)
    Any help is greatly appreciated..
    Best Regards
    gt1942

    I don't see any patch available for 12.0.x and this issue should be fixed in this release.
    Please log a SR for this issue.
    Thanks,
    Hussein

  • Mail doesn't pass on geolocation

    Lion Mail doesn't pass on geolocation information from images. If I send myself a geolocated image from my iPhone, view it in Lion Mail, and then either right click and send to iPhoto or choose to save to iPhoto that the geolocation information doesn't get passed along with the picture. If I drag the image to the desktop and import it into iPhoto the geolocation information is there!  Any way to get Mail to pass this information on to iPhoto?

    In the current version of iPhoto there is a popdown that allows you to choose Look Up Locations 'Automatically' or 'Never' as well as a check box for 'Include location information for published photos'. In the three copies (3 different machines) of iPhoto I have tested the lookup is set to Automatic. In all three, imagesimported into the iPhoto Library from outside show location information, but no images sent to iPhoto from Mail have geolocation information.

  • App from beta2 doesn't pass certification

    Hi
    I just got pretty serious problem. I get the message that my app doesn’t pass certification. I added package to store and it added new Text box to fill in description.. “PRIVACY POLICY”. It want me to add an url address to privacy policy
    even if my app DOESN’T collects personal info,  DOESN’T connects to any online service, or DOESN’T contains other features that could allow users to unintentionally share their personal info. It might be that I forget to edit privacy.html
    in visual studio before I made app package. I have change it, made new package but the url with privacy policy is still there and I don't have one.  Any idea what do I have to put there?

    On Mon, 21 Apr 2014 18:07:05 +0000, ptr.chovan wrote:
    >I just got pretty serious problem. I get the message that my app doesn’t pass certification. I added package to store and it added new Text box to fill in description.. “PRIVACY POLICY”. It want me to add an html address with privacy policy even if
    my app DOESN’T collects personal info,  DOESN’T connects to any online service, or
    DOESN’T contains other features that could allow users to unintentionally share their personal info. It might be that I forget to edit privacy.html in visual studio before I made app package. I have change it, made new package but now I can’t get rid of
    the old package in new release page- package - windows 8.  Any idea what am I
    suppose to do?
    It needs to be posted on a web site. That is a requirement. And you need to
    enter THAT URL in the Description field on the dashboard. Just post it somewhere
    and then edit the release in the dashboard and enter the URL. And yes, It can
    say "does not collect, share or use information: etc.
    -- Barb Bowman

  • ACL doesn't pass RDP&SMB

    I have some problem with inbound ACL filtering. Everything worked fine until yesterday.
    Problem is that in ACL doesn't pass RDP and SMB connections any more, but others do.
    Here is an segment of ACL below:
    200 permit tcp 10.24.1.0 0.0.0.255 host 192.168.1.115 eq 3389
    220 permit tcp 10.24.1.0 0.0.0.255 host 192.168.1.119 eq 3389
    240 permit tcp 10.24.1.0 0.0.0.255 host 192.168.1.109 eq 3389
    260 permit tcp 10.24.1.0 0.0.0.255 host 192.168.1.110 eq 3389
    262 permit tcp 10.24.1.0 0.0.0.255 gt 1023 host 192.168.1.110 eq 3389 (34 matches)
    263 permit tcp host 10.24.1.131 host 192.168.1.109 eq 3389 (53 matches)
    300 permit tcp 10.24.1.0 0.0.0.255 host 192.168.1.112 eq 445
    310 permit tcp 10.24.1.0 0.0.0.255 host 192.168.1.20 eq www (14 matches)
    Lines 262 and 263 are later added, and you can see that matches. In 262 I specified source ports gt 1023, in 263 I specified source host.
    All other lines worked almost one year until yesterday
    Does anyone have idea?

    Hi,
    To me NAT looks good and as you're able to ping the private interface fine across VPN so NAT should not be an issue.
    What doesn't look correct to me is:
    interface GigabitEthernet0/0.1
    encapsulation dot1Q 1 native
    ip address 192.168.131.1 255.255.255.0
    ip nat inside
    ip virtual-reassembly
    Are you going to connect Gig0/0 to a switch to different VLAN interfaces and routing tagged traffic on this router on the Gig0/0 interface? The reason I ask this is that I don't see any other sub-interface being configured other than Gig0/0.1.
    Could you please verify this configuration once again or try removing it?
    Also, it would really help if you could let us know how this Gig0/0 interface is physically connected to you internal device(s).
    HTH!
    Regards,
    Nick

  • Exception for syslogd in com.apple.alf.plist doesn't work after 10.5.6 upgd

    (This is cross-posted from the 10.5 Ins and Setup forum [http://discussions.apple.com/thread.jspa?messageID=8902103#8902103], per the suggestion of a reader.)
    In 10.5.4, I added /usr/sbin/syslogd to the exception list in /usr/libexec/ApplicationFirewall/com.apple.alf.plist.
    This allowed me to keep the mediocre application firewall set to "allow only essential services" and still allow my router to send syslog messages to a log on my Mac.
    I upgraded to 10.5.6 (straight from 10.5.4). Since the upgrade, it appears that the application firewall ignores the additional exception entry I added.
    I've tried moving the exception entry up (replacing the one for configd), but it doesn't matter. I already know about /Library/Preferences/com.apple.alf.plist, so you don't need to suggest that I delete it. It's re-created (as a binary) each time you unload/load the launchctl for syslogd, and it does appear to use the file in /usr/libexec/ApplicationFirewall/com.apple.alf.plist.
    The only two ways I've found to allow syslogd through are:
    1. disable the app firewall (choose "allow all incoming connections" (not my preferred solution)
    2. choose "set access for specific services and applications", which unfortunately allows all the specified applications (and probably allows Apple's hidden list of exceptions that includes things like World of Warcraft and Skype). The hidden list opens the machine to a greater number of attacks from trojan software, and I'd rather have the system locked down, not opened up.
    Does anyone know how I can recover the 10.5.4 functionality, which allowed me to add syslogd as an exception, instead of adding it to the GUI list of applications?

    I also want to receive log information from my Draytek Router I found a reference in the Draytek forum see:
    http://www.forum.draytek.co.uk/viewtopic.php?t=12009&highlight=syslog+mac
    however when I updated the
    com.apple.syslogd.plist
    the required information did not get thru to the Draytek Syslog program.
    I am also using 10.5.6

  • Launchd plist xml to run job several times a day?

    I've been reading about using launchd instead of cron.
    For the life of me I can't find out how to run a script at 10AM and 2PM
    Can you use:
    <key>StartCalendarInterval</key>
    <dict>
    <key>Hour</key>
    <integer>10</integer>
    <key>Hour</key>
    <integer>14</integer>
    or maybe
    <key>StartCalendarInterval</key>
    <dict>
    <key>Hour</key>
    <integer>10</integer>
    <integer>14</integer>
    Maybe I need 2 plists?
    If I wanted to run it every X minutes, I can program that into the XML but I don't know how you could do several specified times a day... or for that matter just on Monday and Friday?
    I've Googled all night and can't find an example. What is the trick... if there IS a trick?
    Thanks,
    Al

    In Apple's system-lingo: "A daemon is a program that runs in the background as part of the overall system (that is, it is not tied to a particular user). A daemon cannot display any GUI; more specifically, it is not allowed to connect to the window server." (see Tech Note 2083)  It doesn't have to be a continuously running program, just one that doesn't interact with users directly.  Your script will probably work in either location, mind you, so the distinction might be academic.
    All enabled plists are loaded at restart or login.  Enabled plists are plists in one of the three user-accessible launchd folders (already mentioned) which are not explicitly disabled by a Disabled key set to true (it's actually a little more complicated than that - the Disabled key in the plist is 'advisory', and the system stores the real enabled list in an undisclosed location - but it usually works).  You only need to use launchctl if you are manually updating a plist and don't want to log out, or sometimes in super-tricky cases where you want to programmatically load a plist (in those cases you set the plist's Disabled key to true so it doesn't load, and then script launchctl to load it by override the Disabled key with the -F or -w options.  probably TMI).  it is set-it-and-forget-it.
    There's no simple utility for this, I think, because not that many people use launchd directly, and those few who do tend to write plists, toss them in the correct folder, and forget about them.  I have a applescript I use for loading and reloading plists which I keep in the script menu:
    on run
              tell application "Finder" to set theItems to the selection as alias list
      relaunchd(theItems)
    end run
    to relaunchd(theItems)
              repeat with thisPlistFile in theItems
                        tell application "Finder" to set containerName to displayed name of container of thisPlistFile
                        if containerName is in {"LaunchAgents", "LaunchDaemons"} then
                                  set thePath to quoted form of (POSIX path of thisPlistFile)
                                  do shell script "launchctl unload " & thePath
                                  do shell script "launchctl load " & thePath
                        end if
              end repeat
    end relaunchd
    The difference between launchd and cron is that cron is (pardon me for putting it this way) a unix-geek tool: its language is highly compressed and symbolic.  good for fast typing in a command-line environment, bad because a single mistyped character can become a major headache to diagnose and fix.  Launchd (like many things Apple) is much more verbose and 'natural language'-like, which means a lot more typing but a generally more user-friendly experience (once you wrap your head around it).  tradeoffs vs. tradeoffs.

Maybe you are looking for