I'm sure this is something simple. Be that as it may, I can't figure it out.
I've been writing simple shell scripts for years that I run via launchd plist files created with Lingon. Generally that works fine unless I do something stupid which is not all that rare.
However, after installing Sonoma, I can't get launchd to run new scripts on either an old Intel iMac or a newer M1 MBA.
To keep things simple, I've written a very brief shell script along with a very minimal launchd plist:
I have no idea where Lingon gets that massive path. Older Lingon generated plist files have something like this:
If I run the script from the command line it works as expected. However, launchd will not run it. I've sat there and watched the console scroll by at the time it should be running and there's nothing.
Lingon's test facility reports no errors and there's nothing in Lingon's log file.
Here's directory listing of an older script along with its plist file. This runs fine every day:
And, here's the new one that doesn't run:
I've been writing simple shell scripts for years that I run via launchd plist files created with Lingon. Generally that works fine unless I do something stupid which is not all that rare.
However, after installing Sonoma, I can't get launchd to run new scripts on either an old Intel iMac or a newer M1 MBA.
To keep things simple, I've written a very brief shell script along with a very minimal launchd plist:
Code:
Sellotape:bin mnewman$ cat ldtest.sh
#!/bin/bash
# shell script to test launchd
now=$(date +%Y-%m-%d-%H%M)
echo $now " hello" >> /users/mnewman/public/ldtest.log
exit 0
Code:
Sellotape:LaunchAgents mnewman$ cat com.mgnewman.ldtest.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>EnvironmentVariables</key>
<dict>
<key>PATH</key>
<string>/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/usr/local/sbin:/opt/local/bin</string>
</dict>
<key>Label</key>
<string>com.mgnewman.ldtest</string>
<key>ProgramArguments</key>
<array>
<string>/Users/mnewman/bin/ldtest.sh</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>StandardErrorPath</key>
<string>/Users/mnewman/public/error.log</string>
<key>StandardOutPath</key>
<string>/Users/mnewman/public/output.log</string>
<key>StartCalendarInterval</key>
<array>
<dict>
<key>Hour</key>
<integer>11</integer>
<key>Minute</key>
<integer>40</integer>
</dict>
</array>
</dict>
</plist>
I have no idea where Lingon gets that massive path. Older Lingon generated plist files have something like this:
Code:
<key>PATH</key>
<string>/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Library/Apple/usr/bin:/Applications/Wireshark.app/Contents/MacOS:/usr/local/sbin</string>
If I run the script from the command line it works as expected. However, launchd will not run it. I've sat there and watched the console scroll by at the time it should be running and there's nothing.
Lingon's test facility reports no errors and there's nothing in Lingon's log file.
Here's directory listing of an older script along with its plist file. This runs fine every day:
Code:
-rwxr-xr-x@ 1 mnewman staff 5472 May 2 2023 chaamyt.sh
-rw-r--r--@ 1 mnewman staff 891 May 2 2023 com.mgnewman.chaamyt.plist
And, here's the new one that doesn't run:
Code:
-rwxr-xr-x@ 1 mnewman staff 138 Nov 7 11:26 ldtest.sh
-rw-r--r--@ 1 mnewman staff 1195 Nov 7 11:48 com.mgnewman.ldtest.plist
[code]
So, what dumb thing have I done this time? I'm sure it's something simple, but beyond my feeble brain to uncover.