Minor update just so I can find it myself years from now...

https://apple.stackexchange.com/questions/364094/how-to-view-status-of-service-e-g-whether-its-running-in-a-format-similar-to
 
seems to be the best documentation I can quickly find. Once you load the 
plist file you can find it....

[vince@mini util]$ sudo launchctl print system | grep wee
   14780      - com.apple.periodic-weekly
   64515      - com.weewx.weewxd
"com.weewx.weewxd" => enabled

[vince@mini util]$ sudo launchctl print system/com.weewx.weewxd
system/com.weewx.weewxd = {
active count = 1
path = /Library/LaunchDaemons/com.weewx.weewxd.plist
type = LaunchDaemon
state = running

program = /opt/homebrew/opt/python@3.12/bin/python3.12
arguments = {
/opt/homebrew/opt/python@3.12/bin/python3.12
/Users/vince/weewx-venv/lib/python3.12/site-packages/weewxd.py
/Users/vince/weewx-data/weewx.conf
}

stderr path = /var/log/weewx_err.log
default environment = {
PATH => /usr/bin:/bin:/usr/sbin:/sbin
}

environment = {
XPC_SERVICE_NAME => com.weewx.weewxd
}

domain = system
minimum runtime = 10
exit timeout = 5
runs = 1
pid = 64515
immediate reason = speculative
forks = 2
execs = 2
initialized = 1
trampolined = 1
started suspended = 0
proxy started suspended = 0
last exit code = (never exited)

spawn type = daemon (3)
jetsam priority = 40
jetsam memory limit (active) = (unlimited)
jetsam memory limit (inactive) = (unlimited)
jetsamproperties category = daemon
submitted job. ignore execute allowed
jetsam thread limit = 32
cpumon = default
probabilistic guard malloc policy = {
activation rate = 1/1000
sample rate = 1/0
}

properties = runatload | inferred program
}

After unloading it, it's not visible in the commands above...

$ sudo launchctl unload /Library/LaunchDaemons/com.weewx.weewxd.plist

$ sudo launchctl print system/com.weewx.weewxd
Bad request.
Could not find service "com.weewx.weewxd" in domain for system

On Sunday, September 1, 2024 at 2:01:42 PM UTC-7 vince wrote:

> The MacOS docs have nothing to do with weewx versions, so they should have 
> been relevant but to me they were definitely clear as mud.  I figured it 
> out experimentally.  Hope this helps....
>
> The plist file the pip installer generates is incorrect.  This one worked 
> for me.  I'll explain below.....
>
> <?xml version="1.0" encoding="UTF-8"?>
> <!-- property list file for weewx daemon -->
> <!-- put this file in /Library/LaunchDaemons -->
> <!-- to start weewx: -->
> <!--   sudo launchctl load -w 
> /Library/LaunchDaemons/com.weewx.weewxd.plist -->
> <!-- to stop: -->
> <!--   sudo launchctl unload /Library/LaunchDaemons/com.weewx.weewxd.plist 
> -->
> <!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>com.weewx.weewxd</string>
>     <key>Disabled</key>
>     <false/>
>     <key>RunAtLoad</key>
>     <true/>
>     <key>ProgramArguments</key>
>     <array>
>         <string>/opt/homebrew/opt/pyt...@3.12/bin/python3.12</string>
>         
> <string>/Users/vince/weewx-venv/lib/python3.12/site-packages/weewxd.py</string>
>         <string>/Users/vince/weewx-data/weewx.conf</string>
>     </array>
>     <key>StandardErrorPath</key>
>     <string>/var/log/weewx_err.log</string>
> </dict>
> </plist>
>
> Basically the <string> lines are the path to python, to weewxd.py, and to 
> the weewx.conf file you want to use.   Do a little light tweaking to match 
> your setup's paths and copy it as indicated in the comments in the file. 
>  Run the sudo command to start it up.  Check your logfile to verify it's 
> running.
>
> Note - "ps -ef | grep wee" will show the process, as will "ps aux | grep 
> wee" to verify it's running.   Also for a Mac you need to append something 
> to weewx.conf so that logging works.  I appended the following to my 
> weewx.conf per the instructions in (I think) the wiki.
>
> [Logging]
>     [[root]]
>         handlers = timed_rotate,
>     [[handlers]]
>         [[[timed_rotate]]]
>             level = DEBUG
>             formatter = verbose
>             class = logging.handlers.TimedRotatingFileHandler
>             filename = log/{process_name}.log
>             when = midnight
>             backupCount = 7
>
>
> On Sunday, September 1, 2024 at 12:01:28 PM UTC-7 Gary S wrote:
>
>>
>> Fair enough. What is the "<domain-target">  argument that's relevant to 
>> weewx? Looking over the macOS launchctl man page and other docs hasn't 
>> helped.
>>
>> prompt> sudo launchctl bootstrap 
>> Usage: launchctl bootstrap <domain-target> [service-path, service-path2, 
>> ...]
>>
>> I also perused many of the available MacOS docs for weewx but many 
>> predate 5.0, so aren't relevant.
>>
>> Thanks.
>>
>>
>> On Sunday, September 1, 2024 at 12:47:13 PM UTC-6 vince wrote:
>>
>> > "Try running `launchctl bootstrap` as root for richer errors."
>> > I'm not sure how to proceed.
>>
>> I would try running 'launchctl bootstrap' as root for richer errors.
>>
>> Sometimes you should try what they suggest.
>>
>> On Sunday, September 1, 2024 at 11:36:35 AM UTC-7 Gary S wrote:
>>
>> I'd been running 4.9.1 for too long and had errors now and again that 
>> required a manual restart, and I thought the Wunderground-caused update 
>> problem was actually me.
>>
>> Anyway, I've migrated to 5.1.0 and I've run into a couple glitches.
>>
>> 1) Trying to run 
>>
>> ~weewx-data/scripts/setup-daemon.sh
>>
>> fails because 'getent' is a Linux script (apparently), not a macOS one. I 
>> commented out that part and the remainder worked fine, however:
>>
>> prompt> sudo launchctl load /Library/LaunchDaemons/com.weewx.weewxd.plist
>> Load failed: 5: Input/output error
>> Try running `launchctl bootstrap` as root for richer errors.
>> prompt>
>>
>> I'm not sure how to proceed.
>>
>> 2) I also need to figure out how to merge weewx.sdb from 
>> /Users/shared/weewx/archive/weewx.sb (ends at 13:15 26 Aug)
>>
>> with
>>
>>  ~/weewx-data/archive/weewx.sdb (current and being updated)
>>
>> Any advice is welcome on either!
>>
>>
>>
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to weewx-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/f7736606-3387-42fe-a020-4a6bde78db63n%40googlegroups.com.

Reply via email to