Opened 4 years ago

Last modified 4 years ago

#60239 new defect

creating startupitem for apache2

Reported by: sam452 (sam walton) Owned by:
Priority: Low Milestone:
Component: ports Version: 2.6.2
Keywords: Cc:
Port: apache2

Description (last modified by ryandesign (Ryan Carsten Schmidt))

Thanks for the MacPorts project! I've successfully got my apache 2.4 running on an old PowerPC serving several sites.
But whenever this is a power failure, I've always had to manually start apache. I can see in /Library/LaunchDaemons/ other port start plist files but not apache.
sudo port load apache2 fails at:

:error:load Failed to load apache2: Launchd plist /Library/LaunchDaemons/org.macports.apache2.plist was not found
:debug:load Error code: NONE
:debug:load Backtrace: Launchd plist /Library/LaunchDaemons/org.macports.apache2.plist was not found
:debug:load Backtrace: Launchd plist /Library/LaunchDaemons/org.macports.apache2.plist was not found
:debug:load     while executing
:debug:load "portstartupitem::foreach_startupitem {
:debug:load         if {(![info exists ::portstartupitem::load_only] || $si_name
 in ${::portstartupitem::load_only})

So it would appear that info exists::portstartupitem::load_only exists since it expects it's already instantiated. I thought I could find in your GitHub repo this file, but reading https://guide.macports.org/chunked/reference.startupitems.html suggests this is created when apache2 was installed.

I attempted to run

sudo port startupitem.create

but that failed as expected.

My question is how to instantiate this plist without reinstalling apache2?
thx, sam

Change History (4)

comment:1 Changed 4 years ago by ryandesign (Ryan Carsten Schmidt)

Description: modified (diff)
Port: apache2 added
Type: requestdefect

The apache2 port does install the file /Library/LaunchDaemons/org.macports.apache2.plist, unless you have configured MacPorts not to install such plists.

comment:2 Changed 4 years ago by ryandesign (Ryan Carsten Schmidt)

Does port contents apache2 show this plist? If yes, but the plist is in fact missing, you can get it back by deactivating and reactivating the port.

But if the plist is not listed in the contents, then you may have configured MacPorts not to install those plists, for example by setting startupitem_install no or startupitem_type none.

comment:3 Changed 4 years ago by sam452 (sam walton)

sudo port contents apache2 | grep plist returns two. The expected /Library/LaunchDaemons/org.macports.apache2.plist which I do not have and /Users/me/macports/etc/LaunchDaemons/org.macports.apache2/org.macports.apache2.plist which I had not found until now.

What is odd is that when I viewed the latter file, its contents is not apache2 but my first attempt to duplicate the working vsftpd plist in LaunchDaemons/ into a "Save As" into an apache2 plist. I rm'd that attempt to research if there is an existing plist for my apache2 port.

Will deactivating, reactivating the port save my work in the httpd config files? Thx.

comment:4 in reply to:  3 Changed 4 years ago by ryandesign (Ryan Carsten Schmidt)

Replying to sam452:

sudo port contents apache2 | grep plist returns two. The expected /Library/LaunchDaemons/org.macports.apache2.plist which I do not have and /Users/me/macports/etc/LaunchDaemons/org.macports.apache2/org.macports.apache2.plist which I had not found until now.

What is odd is that when I viewed the latter file, its contents is not apache2 but my first attempt to duplicate the working vsftpd plist in LaunchDaemons/ into a "Save As" into an apache2 plist. I rm'd that attempt to research if there is an existing plist for my apache2 port.

Sounds like you or something has removed and/or modified files the port intended to provide. Deactivating and reactivating the port should set things right again.

Will deactivating, reactivating the port save my work in the httpd config files? Thx.

Configuration files will not be overwritten. You can confirm this by verifying that port contents apache2 does not mention your .conf files. (It only mentions .conf.orig files.)

It should be similar for most ports, however it is a manual process to identify config files and to set it up to do this. If you find a port that is not set up to preserve your conf files, please file a bug report.

Note: See TracTickets for help on using tickets.