31

service is an "high-level" command used for starting and stopping services in different unixes and linuxes. Depending on the "lower-level" service manager, service redirects on different binaries. For example, on CentOS 7 it redirects to systemctl, while on CentOS 6 it directly calls the relative /etc/init.d script. On the other hand, in older Ubuntu ...


26

Exit code 143 means that the program received a SIGTERM signal to instruct it to exit, but it did not handle the signal properly. This is almost always due to programming errors, and is pretty common with Java applications of all types. You should be able to suppress this by adding the exit code into the unit file as a "success" exit status: [Service] ...


24

Finally, fixed it. Systemd requires redis to run non-daemonised, so the config needed to change: # /etc/redis.conf daemonize yes # << comment this out


22

My guess is that you're running a non-privileged container. systemd requires CAP_SYS_ADMIN capability but Docker drops that capability in the non privileged containers, in order to add more security. systemd also requires RO access to the cgroup file system within a container. You can add it with –v /sys/fs/cgroup:/sys/fs/cgroup:ro So, here a few steps on ...


19

I created this file: sudo vi /etc/systemd/system/nagios.service and added the following: [Unit] Description=Nagios BindTo=network.target [Install] WantedBy=multi-user.target [Service] User=nagios Group=nagios Type=simple ExecStart=/usr/local/nagios/bin/nagios /usr/local/nagios/etc/nagios.cfg Then the following: sudo systemctl enable /etc/systemd/...


12

Two options: PAGER=cat systemctl status service1 service2 service3 systemctl --no-pager status service1 service2 service3 Explanation: Those lines 1-62 messages are produced by a pager program, the commonly used ones are more and less. Pager programs intend to make output more user-friendly, scrollable, etc. They are especially important on less feature-...


11

After a service stops (or fails to start), systemd waits for a short period of time before attempting to restart it. The amount of wait time is configurable by setting RestartSec= in the unit. RestartSec= Configures the time to sleep before restarting a service (as configured with Restart=). Takes a unit-less value in seconds, or a time span value ...


10

On older systemd versions, you'll have to use journalctl --user --user-unit=SERVICENAME (on newer versions journalctl --user -u SERVICENAME will work fine). However, this only works if the Storage directive of the [Journal] section of /etc/systemd/journald.conf is set to persistent (instead of auto or volatile). Reboot after editing the configuration file ...


9

Amazon Linux v 2.0 does support systemd and comes installed by default: cat /etc/os-release NAME="Amazon Linux" VERSION="2.0 (2017.12)" ID="amzn" ID_LIKE="centos rhel fedora" VERSION_ID="2.0" PRETTY_NAME="Amazon Linux 2.0 (2017.12) LTS Release Candidate" ANSI_COLOR="0;33" CPE_NAME="cpe:2.3:o:amazon:amazon_linux:2.0" HOME_URL="https://amazonlinux.com/" rpm -...


9

To run redis under systemd, you need to set supervised systemd. See the configuration file: # If you run Redis from upstart or systemd, Redis can interact with your # supervision tree. Options: # supervised no - no supervision interaction # supervised upstart - signal upstart by putting Redis into SIGSTOP mode # supervised systemd - signal ...


8

I'm having the same issue with Ubuntu 16.04, systemd and NginX 1.10.1 from source. I'm was using the default nginx.service file: https://www.nginx.com/resources/wiki/start/topics/examples/systemd/ The issue was the nginx.pid lcoation, to fix it I: Fired up Nginx without the service sudo nginx start Updated the locate db: sudo updatedb Found the ...


8

As MadHatter has said in a comment to your question, RHEL 6 doesn't use SystemD (of which systemctl is a part), but rather use SYSV init scripts. As said by TessellatingHeckler, the closest equivalent would be the service network status command, but it's not quite the same.


8

To complement Michael's answer, the exit code 143 is normal here, it is the way that the java VM received a SIGTERM signal, send by systemd to stop the process. The SIGTERM signal has a numeric value of 15 ( see man signal). Now according to the Posix specification, "The exit status of a command that terminated because it received a signal shall be reported ...


8

Remove the mysqld.service symbolic link in /etc/systemd/system and enable the mysqld.service again: rm /etc/systemd/system/mysqld.service systemctl enable mysqld.service


7

systemctl is basically a more powerful version of service. With service you can only do commands related to the service (i.e. status, reload, restart) whereas with systemctl you can use more advanced commands such as: systemctl is-failed name.service # check if service failed to load Or masking services: systemctl mask name.service There's a lot of good ...


6

The problem was SELinux only allowing the web server to make outbound connections to a limited set of ports. Fixed by doing: semanage port --add --type http_port_t --proto tcp 8001 after installing semanage with yum install policycoreutils-python Nodejs Nginx error: (13: Permission denied) while connecting to upstream


6

I am the Phusion Passenger author. You are misunderstanding something fundamentally about Nginx. First of all, Nginx does not support dynamically loadable modules. This means that the only way to extend Nginx, is by recompiling Nginx from scratch, with certain modules included. In your mental model, you seem to think that passenger-install-nginx-module ...


6

systemctl is not like the good old init-scripts. According to its man page, it supports the following commands that are like the init-script commands you are searching for: start Start (activate) one or more units specified on the command line. stop Stop (deactivate) one or more units specified on the command line. reload Asks all units listed on the ...


6

You can check loaded unit by command systemctl show <unit>.service. As far I know there is no tool to check changes in unit files. As well you could run this bash command for var in $(systemctl | grep running | awk '{print $1}'); do systemctl status $var | grep "changed on disk" | grep ".service"; done it would show what files has been changed. ...


6

This is because systemctl start returns immediately, without waiting for traffic server to be actually started. Is there a way to tell systemctl start to only return once the service is started? systemctl start does wait for the service to be ready (except if invoked with --no-block), the service just needs to indicate that properly (i. e., not use ...


5

Fedora 21 and RHEL/CentOS 7 use the new Python-based postgrey reimplementation. In this implementation the only change you need in your Postfix configuration is to call the service from smtpd_recipient_restrictions. For instance, taken from my own mail server: smtpd_recipient_restrictions = #.....other stuff here # This should be next-to-...


5

This is happening probably because of rate limiting in journalctl conf. Check RateLimitInterval and RateLimitBurst in /etc/systemd/journald.conf file.


5

Since it hasn't stated that it is ready within 90 seconds (the default start timeout), systemd has decided that your service has failed. Failed services get everything killed off. Becuase of Restart=always, your failed service is then restarted, and the cycle repeats. Also, Restart=on-failure might be better in this case.


5

If you take a look at the tor.service unit, you will see that it has a command to attempt to verify the Tor configuration before starting the service. ExecStartPre=/usr/bin/tor --runasdaemon 0 --defaults-torrc /usr/share/tor/defaults-torrc -f /etc/tor/torrc --verify-config This is where things are going wrong. When this runs, the configuration fails to ...


4

Federico, thank you very much for your help. I checked /var/log/messages and saw that on manual start, first sendmail is shut down and then postfix is started. I figured there might be some kind of sendmail/postfix conflict on restart so I did yum remove sendmail and it's all good now!


4

The quotes on this line are likely to be causing the problem: service {"$ntp_services": Using "" containing a variable will create a string with the variable expanded inside it. This is probably why Puppet is reporting a single service with the name [ntpd ntpdate] (i.e. an array) rather than two different services. Change it to: service { $ntp_services: ...


4

If you're asking if systemd will create a PID file for the daemon, it will not, per: https://www.freedesktop.org/software/systemd/man/systemd.service.html#PidFile= PIDFile= Takes an absolute file name pointing to the PID file of this daemon. Use > of this option is recommended for services where Type= is set to forking. systemd will read the PID ...


4

Amazon Linux is ultimately based on an old version of CentOS/RHEL and doesn't support systemd. https://forums.aws.amazon.com/message.jspa?messageID=731256


4

You should start, restart, stop tomcat with systemd commands. You have started tomcat servicesudo systemctl start tomcat, so if you want to stop it you need to go trough systemd:sudo systemctl stop tomcat. In the unit file, according to the link that you posted, are settings that are: RestartSec=10 which instructs systemd to restart tomcat.service after 10 ...


4

Why don't you just use systemctl is-active to check whether it is running? For example: systemctl is-active --quiet apache2 || systemctl start apache2


Only top voted, non community-wiki answers of a minimum length are eligible