You are not logged in.

#1 2013-11-04 13:01:39

ngiunxy
Member
Registered: 2013-11-04
Posts: 8

Apache systemd[Solved]

Hello,i  installed apache server on my archlinux,but i get a problem .
when i start the apache service,it works,but i can't find the httpd.pid file in /run
so i have to delete the  option PIDFile in the httpd.service and add the  option GuessMainPid
do you kown how to do with this

Last edited by ngiunxy (2013-11-06 06:45:34)

Offline

#2 2013-11-04 15:58:29

mrinx
Member
From: Richmond, VA
Registered: 2013-08-01
Posts: 87
Website

Re: Apache systemd[Solved]

How did you install your apache server? (Did you use arch wiki article?) How are you starting your apache service?


English isn't my first language.
Is Arch Linux user called archer? Where are our bows and arrows?

Offline

#3 2013-11-05 03:38:39

ngiunxy
Member
Registered: 2013-11-04
Posts: 8

Re: Apache systemd[Solved]

make and make install,i write a httpd.service by myself to start the apache service

mrinx wrote:

How did you install your apache server? (Did you use arch wiki article?) How are you starting your apache service?

Offline

#4 2013-11-05 04:02:01

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,722

Re: Apache systemd[Solved]

Is there any particular reason you did not just use pacman -Syu apache    ??

Unfortunately, you are off the beaten path and are not likely to get the best help when you roll your own service to start things you have hand installed.


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way

Offline

#5 2013-11-05 11:05:36

ngiunxy
Member
Registered: 2013-11-04
Posts: 8

Re: Apache systemd[Solved]

i   have hand installed  because i'm learning linux  and want to konow the details of the service.

ewaller wrote:

Is there any particular reason you did not just use pacman -Syu apache    ??

Unfortunately, you are off the beaten path and are not likely to get the best help when you roll your own service to start things you have hand installed.

Offline

#6 2013-11-05 12:22:16

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: Apache systemd[Solved]

systemd unit files are thoroughly documented - start with systemd.unit(5), then move on to systemd.service(5).

That said, how did you manage to write the httpd.service you're using now?

Offline

#7 2013-11-05 14:39:13

mrinx
Member
From: Richmond, VA
Registered: 2013-08-01
Posts: 87
Website

Re: Apache systemd[Solved]

ngiunxy wrote:

i   have hand installed  because i'm learning linux  and want to konow the details of the service.

That's nice, but I can tell you that I'm learning linux even when I'm using package manager. You can always look at services what were installed for you by pacman and make changes to them. May I see your httpd.service?


English isn't my first language.
Is Arch Linux user called archer? Where are our bows and arrows?

Offline

#8 2013-11-06 04:32:58

ngiunxy
Member
Registered: 2013-11-04
Posts: 8

Re: Apache systemd[Solved]

[Unit]
Description=Apache Web Server
After=network.target remote-fs.target

[Service]
Type=forking
GuessMainPid=yes
ExecStart=/usr/sbin/apachectl start
ExecStop=/usr/sbin/apachectl graceful-stop
ExecReload=/usr/sbin/apachectl graceful
PrivateTmp=true
LimitNOFILE=infinity

[Install]
WantedBy=multi-user.target

tomk wrote:

systemd unit files are thoroughly documented - start with systemd.unit(5), then move on to systemd.service(5).

That said, how did you manage to write the httpd.service you're using now?

Offline

#9 2013-11-06 04:33:30

ngiunxy
Member
Registered: 2013-11-04
Posts: 8

Re: Apache systemd[Solved]

[Unit]
Description=Apache Web Server
After=network.target remote-fs.target

[Service]
Type=forking
GuessMainPid=yes
ExecStart=/usr/sbin/apachectl start
ExecStop=/usr/sbin/apachectl graceful-stop
ExecReload=/usr/sbin/apachectl graceful
PrivateTmp=true
LimitNOFILE=infinity

[Install]
WantedBy=multi-user.target

mrinx wrote:
ngiunxy wrote:

i   have hand installed  because i'm learning linux  and want to konow the details of the service.

That's nice, but I can tell you that I'm learning linux even when I'm using package manager. You can always look at services what were installed for you by pacman and make changes to them. May I see your httpd.service?

Offline

#10 2013-11-06 04:54:13

ngiunxy
Member
Registered: 2013-11-04
Posts: 8

Re: Apache systemd[Solved]

i  finally find the file  http.pid   in the   directory logs,and change the option PIDFile=/usr/local/apache/logs/httpd.pid  ,now it works wll, thank you very much all the same

Offline

#11 2013-11-06 05:44:28

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: Apache systemd[Solved]

@ngiunxy, a couple things.  First and foremost, welcome to the Arch Linux forums!  Enjoy your stay.

Also, when you post things like those service files you whipped up, you need to use code tags.  To see how to do this follow the 'BBCode' link at the bottom of each page. 

Finally, I see you installed the apache package by hand.  A big part of any distribution how it handles the packages that it is made up of.  Hence a package manager is often so central to the identity of the distribution.  Around here, we have pacman and friends, and in line with Arch's Keep it Simple philosophy, not only is the use of pacman pretty simple, but also the creation of packages. 

Packages are made with the 'makepkg' tool that is shipped with the pacman package.  'Makepkg' uses specially formatted files called PKGBUILDs to create the package.  There are also included examples already on your system, and if you can build the package by hand, you have enough knowledge to typically be able to package it up.  This process is covered pretty extensively in the wiki, as is just about anything other information you may need about how to use Arch Linux.

Enjoy!



Edit: Oh yeah, and please mark your thread as [Solved] if you are satisfied with the result.  You can edit the first post which will also allow you to edit the title.

Last edited by WonderWoofy (2013-11-06 05:45:18)

Offline

#12 2013-11-06 05:46:08

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,722

Re: Apache systemd[Solved]

Great!   Please mark your thread as solved.


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way

Offline

#13 2013-11-06 06:47:34

ngiunxy
Member
Registered: 2013-11-04
Posts: 8

Re: Apache systemd[Solved]

thank you for you propose

WonderWoofy wrote:

@ngiunxy, a couple things.  First and foremost, welcome to the Arch Linux forums!  Enjoy your stay.

Also, when you post things like those service files you whipped up, you need to use code tags.  To see how to do this follow the 'BBCode' link at the bottom of each page. 

Finally, I see you installed the apache package by hand.  A big part of any distribution how it handles the packages that it is made up of.  Hence a package manager is often so central to the identity of the distribution.  Around here, we have pacman and friends, and in line with Arch's Keep it Simple philosophy, not only is the use of pacman pretty simple, but also the creation of packages. 

Packages are made with the 'makepkg' tool that is shipped with the pacman package.  'Makepkg' uses specially formatted files called PKGBUILDs to create the package.  There are also included examples already on your system, and if you can build the package by hand, you have enough knowledge to typically be able to package it up.  This process is covered pretty extensively in the wiki, as is just about anything other information you may need about how to use Arch Linux.

Enjoy!



Edit: Oh yeah, and please mark your thread as [Solved] if you are satisfied with the result.  You can edit the first post which will also allow you to edit the title.

Offline

#14 2013-11-06 14:53:41

mrinx
Member
From: Richmond, VA
Registered: 2013-08-01
Posts: 87
Website

Re: Apache systemd[Solved]

I would like to suggest you to have your pid stored under /run directory. It's not important but I think it can be handy to have all pids in one directory. Happy Archering wink


English isn't my first language.
Is Arch Linux user called archer? Where are our bows and arrows?

Offline

#15 2013-11-06 19:03:35

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: Apache systemd[Solved]

mrinx wrote:

I would like to suggest you to have your pid stored under /run directory. It's not important but I think it can be handy to have all pids in one directory. Happy Archering wink

Having it under /run is especially good because it is not an on-disk filesystem.  It is on a tmpfs, so if your machine panics, you won't be left with a stale pid file that might prevent your service from successfully starting back up.

Offline

Board footer

Powered by FluxBB