LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > CentOS
User Name
Password
CentOS This forum is for the discussion of CentOS Linux. Note: This forum does not have any official participation.

Notices


Reply
  Search this Thread
Old 02-09-2016, 09:39 AM   #1
mariogarcia
Member
 
Registered: Sep 2005
Distribution: debian, solaris 10
Posts: 202

Rep: Reputation: 31
custom systemd httpd service fails to start on centos 7


I have the following systemctl service
Code:
[Unit]
Description=The Apache HTTP Server for foobar
After=network.target remote-fs.target nss-lookup.target
Documentation=man:httpd(8)
Documentation=man:apachectl(8)

[Service]
Type=notify
EnvironmentFile=/etc/sysconfig/httpd
ExecStart=/usr/sbin/httpd -f /etc/httpd/conf.d/httpd.foobar.conf
ExecReload=/usr/sbin/httpd -f /etc/httpd/conf.d/httpd.foobar.conf -k graceful
ExecStop=/bin/kill -WINCH ${MAINPID}
# We want systemd to give httpd some time to finish gracefully, but still want
# it to kill httpd after TimeoutStopSec if something went wrong during the
# graceful stop. Normally, Systemd sends SIGTERM signal right after the
# ExecStop, which would kill httpd. We are sending useless SIGCONT here to give
# httpd time to finish.
KillSignal=SIGCONT
PrivateTmp=true

[Install]
WantedBy=multi-user.target
the service fails with a timeout:
systemctl status httpd_foobar.service
httpd_foobar.service - The Apache HTTP Server for foobar
Loaded: loaded (/usr/lib/systemd/system/httpd_foobar.service; disabled; vendor preset: disabled)
Active: failed (Result: timeout) since Tue 2016-02-09 15:52:06 CET; 21min ago
Docs: man:httpd(8)
man:apachectl(8)
Process: 23622 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=1/FAILURE)
Process: 23620 ExecStart=/usr/sbin/httpd -f /etc/httpd/conf.d/httpd.foobar.conf (code=exited, status=0/SUCCESS)
Main PID: 23620 (code=exited, status=0/SUCCESS)

Feb 09 15:50:36 web7 systemd[1]: Starting The Apache HTTP Server for foobar...
Feb 09 15:50:36 web7 kill[23622]: kill: cannot find process ""
Feb 09 15:50:36 web7 systemd[1]: httpd_foobar.service: control process exited, code=exited status=1
Feb 09 15:52:06 web7 systemd[1]: httpd_foobar.service stop-sigterm timed out. Killing.
Feb 09 15:52:06 web7 systemd[1]: Failed to start The Apache HTTP Server for foobar.
Feb 09 15:52:06 web7 systemd[1]: Unit httpd_foobar.service entered failed state

is it something related to selinux?

when i restart manually via the command line:
it works but not when trying via systemctl.
 
Old 02-10-2016, 12:00 AM   #2
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 13,639
Blog Entries: 9

Rep: Reputation: 3755Reputation: 3755Reputation: 3755Reputation: 3755Reputation: 3755Reputation: 3755Reputation: 3755Reputation: 3755Reputation: 3755Reputation: 3755Reputation: 3755
did you write that service file yourself?
have you looked up centos wiki, then apache wiki, then systemd documentation? (*)
if this is apache, are you sure you need httpd to start it? i have a debian server and it doesn't have httpd in $PATH.

(*) archwiki has always been very helpful with systemd
 
Old 02-12-2016, 08:12 AM   #3
mariogarcia
Member
 
Registered: Sep 2005
Distribution: debian, solaris 10
Posts: 202

Original Poster
Rep: Reputation: 31
Hello
I wrote the service file based in the one that comes with the rpm. i just changed the ExecStart and Execreload..

i have set up selinux as permissive but the problem is not related to selinux..

I have read the documentation of systemd. centos and apache but I did not find any hints as to whiy systemd hangs out... that Is why I reached out to see if someone has any ideas..

thanks in advance.
 
Old 02-13-2016, 02:51 AM   #4
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 13,639
Blog Entries: 9

Rep: Reputation: 3755Reputation: 3755Reputation: 3755Reputation: 3755Reputation: 3755Reputation: 3755Reputation: 3755Reputation: 3755Reputation: 3755Reputation: 3755Reputation: 3755
undo that stuff.

try
Code:
# systemctl start apache2
instead (*).

if that works, do
Code:
# systemctl enable apache2
assuming you just want to start your apache server - you never said what you actually want.

(*) at least this is how it works on debian stable. alternatively, i think you can also use apachectl.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] CentOS 7 - httpd and systemd problem! masterross CentOS 22 04-08-2015 07:51 AM
[SOLVED] new Sabayon 13.04 install: Can't get GPM to start as a service... {systemd} jtwdyp Sabayon 2 06-16-2013 12:46 PM
service start httpd fails, manually starting with same command works jonboede Linux - General 1 02-19-2008 11:45 AM
service httpd fails Red Squirrel Linux - Software 3 07-02-2006 03:22 PM
httpd service stop fails, no pid, this after latest update squadja Red Hat 2 08-11-2004 02:29 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > CentOS

All times are GMT -5. The time now is 04:09 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration