Startupitems for non-root user

macports at parvis.nl macports at parvis.nl
Thu May 31 18:36:15 UTC 2018


Looking through all Portfiles for examples, I found these:
  executable sudo -u ${cassandrauser} env \
  executable sudo -u elasticsearch ${prefix}/bin/${name}

So I tried this:
  startupitem.create  yes
  startupitems \
     name munin-asyncd \
       executable sudo -u munin ${prefix}/lib/munin/munin-asyncd

And this is what I got:
  <?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>org.macports.munin-asyncd</string>
  <key>ProgramArguments</key>
  <array>
	<string>/opt/port2/bin/daemondo</string>
	<string>--label=munin-asyncd</string>
	<string>--start-cmd</string>
	<string>sudo</string>
	<string>;</string>
	<string>--pid=exec</string>
  </array>
  <key>Disabled</key><true/>
  <key>KeepAlive</key><true/>
  </dict>
  </plist>

What is happening here? I would have expected something like
  sudo
  -u
  munin
  ${prefix}/lib/munin/munin-asyncd
(delimited by <string>..</string>)

- How should I fix this?

- launchd knows when the job died. Why is daemondo even used for an executable startupitem?

- suggestion: most daemons run under their own system user; make a keyword to specify that user.

paul.


More information about the macports-dev mailing list