LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat
User Name
Password
Red Hat This forum is for the discussion of Red Hat Linux.

Notices


Reply
  Search this Thread
Old 05-20-2015, 02:25 AM   #1
shazgaurav
LQ Newbie
 
Registered: Apr 2013
Posts: 29

Rep: Reputation: Disabled
INIT script in rhel 7:server does not stop


Hi,

I made an init script(hybris.service) for hybris on RHEL7 under /usr/lib/systemd/system
------------------------------------------------------------------
[Unit]
Description=Hybris Server
After=syslog.target network.target remote-fs.target nss-lookup.target

[Service]
ExecStart=/app/hybris5.4/hybris/bin/platform/hybrisserver.sh start
ExecStop=/app/hybris5.4/hybris/bin/platform/hybrisserver.sh stop
SuccessExitStatus=143
Type=simple
User=hybrisadmin
Group=hybrisadmin

TimeoutSec=300

[Install]
WantedBy=multi-user.target
-------------------------------------------------------------------
When I execute the script it runs successfully and /var/log/messages are updated with the
May 20 12:46:57 xxxxxxxx systemd: Stopped Hybris Server
message but hybris server does not stop.
Please help me with the resolution/next steps.

Thanks in advance...!!!!

I am a newbie..any help will be greatly appreciated

Last edited by shazgaurav; 05-20-2015 at 09:51 AM.
 
Old 05-22-2015, 03:09 PM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
Verify the command Systemd is calling to do the stop actually works. (What you saw in the log says Systemd worked but that doesn't guarantee the command it called worked.)

Run "/app/hybris5.4/hybris/bin/platform/hybrisserver.sh stop" at command line and see what it says.

Also be sure to run "systemctl status -l hybris" to see what the logging is showing when you ran the "systemctl stop hybris".

I'm also curious why you have:
SuccessExitStatus=143
Typically a non-zero exit status is a failure rather than a success. It may be systemd treated the stop as successful because the command it is calling resulted in a 143 exit status.

When you run "/app/hybris5.4/hybris/bin/platform/hybrisserver.sh stop" at command line by itself type "echo $?" after it finishes and before you do anything else to see what its exit status was.


Note:
/var/log/messages still has logging but the Systemd expects use of above status command to see the logs (or use of the journalctl command).

Also this Systemd "unit" replaces the old SystemV "init" scripts so what you have isn't technically an "init" script. The init scripts (some still exist in RHEL7) are in /etc/init.d and linked to from /etc/rc?.d directories. However, the intent is that over time all the init scripts will go away in favor of Systemd "unit" files like the one you created.

Last edited by MensaWater; 05-26-2015 at 12:12 PM.
 
Old 05-31-2015, 04:07 PM   #3
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: SlackwareŽ
Posts: 13,925
Blog Entries: 44

Rep: Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159
Moderator response

Moved: This thread is more suitable in <Red Hat> and has been moved accordingly to help your thread/question get the exposure it deserves.
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
stop script used to stop tomcat server is working intermittently BhaktiK Linux - Server 4 03-15-2013 09:38 AM
init script (stop) doesn't remove process IDs tdnnash25 Linux - Server 3 12-23-2009 09:01 PM
custom init.d script will start but won't stop Qwerty9119 Red Hat 2 05-03-2007 12:51 PM
custom init.d script will start but won't stop Qwerty9119 Linux - General 2 05-03-2007 12:23 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat

All times are GMT -5. The time now is 09:23 AM.

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
Open Source Consulting | Domain Registration