Skip to main content
92 votes

"reboot" or "shutdown -r now": what restart command is safer?

Shutdown is preferable because it allows you to specify the reason for the drastic action -- something you should always do. The message will be recorded in the log(s) for posterity. For example: ...
Mikhail T.'s user avatar
  • 2,411
59 votes
Accepted

"reboot" or "shutdown -r now": what restart command is safer?

For Red Hat systems, there is no functional difference between reboot and shutdown -r now. Do whatever is easier for you.
ewwhite's user avatar
  • 199k
31 votes

What's the easiest way to make my old init script work in systemd?

For me it was easier to just add the init info block in the header as suggested here: #!/bin/sh ### BEGIN INIT INFO # Provides: solr # Required-Start: # Required-Stop: # Default-...
eadmaster's user avatar
  • 847
17 votes

"reboot" or "shutdown -r now": what restart command is safer?

Using reboot is safer. Using reboot your intent is clear and there is no way to mistype it for something else like shutdown -t now which could leads to a few headache if you are using on a remote ...
Antzi's user avatar
  • 303
13 votes

"reboot" or "shutdown -r now": what restart command is safer?

If you take a look, in RHEL 7 both /sbin/shutdown and /sbin/reboot are actually just symlinks to systemd's systemctl command. So, use whatever you want. No functional difference as ewwhite told, not ...
Janne Pikkarainen's user avatar
13 votes
Accepted

Parse error in sudoers file

A "sudo: parse error in ..." originating from /etc/sudoers or any of the files included with either the #include <filename> or #includedir <path> directives may be caused by a missing new-...
HBruijn's user avatar
  • 81.2k
12 votes

Start PHP-FPM with root option automatically

On systemd systems, you may have to configure this via systemd rather than system V init scripts The below steps are tested and working on Ubuntu 16.04 LTS. And this is your culprit for redirected ...
Ryan Babchishin's user avatar
10 votes

What's the easiest way to make my old init script work in systemd?

It's more convenient to run Solr using provided start script. The systemd unit file looks like this: [Unit] Description=Apache Solr for Nextcloud's nextant app fulltext indexing After=syslog.target ...
Jiří Kozlovský's user avatar
8 votes

PHP-FPM does not automatically start after reboot

I just ran into this very problem on Ubuntu 16.04 and I'm leaving my answer here for future users from Google who stumble onto the problem. Since chkconfig is mostly specific to CentOS, it obviously ...
CubicleSoft's user avatar
8 votes
Accepted

Is there a way to control filesystem access with systemd?

You have a number of options actually, which you can define in the unit file(s) for your services. They all work on the same principle, by using bind mounts within the namespace systemd sets up for ...
HBruijn's user avatar
  • 81.2k
7 votes
Accepted

Where should init scripts be placed in Amazon Linux 2?

The new way is to create systemd unit file for your application or startup script. It may seem like an overkill for simple startup scripts but it is the way that most current Linux distros adopted - ...
MLu's user avatar
  • 25.7k
6 votes

How to find error messages from Linux init.d/rc.d scripts?

Messages from init scripts are generally not captured anywhere. Thus, you need to implement a way to do it yourself. A good idea is to use logger to send all output to syslog. This example will send ...
qugu's user avatar
  • 61
5 votes

s6 : how to get a run script running only once?

You can do this with s6, by including s6-svc -O /etc/s6/servicefolder at the beginning of your run script. This will tell to s6 to not start this service again. Source: https://skarnet.org/software/...
Jan Christian Grünhage's user avatar
5 votes

PHP-FPM does not automatically start after reboot

Since CentOS 7 you simply need to enable the services via systemctl: systemctl enable php-fpm You can check if it's running afterwards via: systemctl status php-fpm
Manuel's user avatar
  • 151
5 votes
Accepted

openvpn post-up script fails with “Operation not permitted” if and only if openvpn is run by systemd

This is the service file for OpenVPN (/lib/systemd/system/[email protected]): [Unit] Description=OpenVPN connection to %i PartOf=openvpn.service ReloadPropagatedFrom=openvpn.service Before=systemd-...
ysdx's user avatar
  • 1,683
5 votes

Restarting Puma using init.d

My solution was to switch to systemd as suggested in one of the comments above. Remove the init.d for puma sudo rv /etc/init.d/puma sudo update-rc.d -f puma remove sudo rm /usr/local/bin/run-puma ...
Turgs's user avatar
  • 285
5 votes
Accepted

Create a custom /etc/init.d script in Debian 10 Buster

Smartass response: apt-get install sysvinit-core Disclaimer: I have not done this on Buster, don't try it on an important system. Assuming you'd like to stick with the new default since Jessie, ...
Mantriur's user avatar
  • 389
4 votes

Parse error in sudoers file

Using the copy module is probably not the best choice to handle /etc/sudoers with Ansible. The lineinfile module has an option to validate the file before saving. It is also easier to remove the line,...
Henrik Pingel's user avatar
4 votes
Accepted

Does systemd allow for functionality like authbind? Where you can allow a non-root user to bind to a priv port?

You could use systemd's socket activation functionality to achieve what you want (if the program you're running supports it). Systemd binds to the port as root then passes the socket to the ...
logix's user avatar
  • 156
3 votes
Accepted

Start PHP-FPM with root option automatically

I finally found a solution. It turned out Ubuntu was using systemd to start and restart PHP-FPM and was therefor ignoring the init.d files. If you experience issues with adjustments to init.d files ...
redelschaap's user avatar
3 votes

Running arbitrary program as daemon from init script

The command "doesn't complete" because the daemon function does not run your application in the background for you. You will need to add an & to the end of your daemon command like so: daemon --...
Stuporman's user avatar
  • 131
3 votes

missing start-stop-deamon on centos 6.8

start-stop-daemon is a Debian-specific script that exists only on Debian and systems derived from it, such as Ubuntu. You won't find it on CentOS, and indeed, it shouldn't be used as it isn't there. ...
Michael Hampton's user avatar
3 votes

systemd failing enable with "service is transient or generated". What's wrong with this configuration?

I suspect the file you placed in /etc/init.d/ was supposed to go to /etc/systemd/system/. Move the systemd .service file away from the location meant for System V style init scripts and to a systemd ...
anx's user avatar
  • 9,952
2 votes

How to automatically start mysql after server restart (CentOS + other distros)?

To enable mysql service on startup, use following command. systemctl enable mysqld.service It will create appropriate symbolic link for you.
Kshitiz Sharma's user avatar
2 votes

Can I make systemd show service status after starting or stopping a service?

I also needed it, so I made it a shell script function. # Usage # sc start nginx # sc start nginx php74-php-fpm function sc { name="${@:(2)}"; echo "COMMAND: ${1}, NAME: ${name}...
Been Kyung-yoon's user avatar
2 votes

What's the easiest way to make my old init script work in systemd?

I had the same error while trying to use a LSB init script on CentOS 7. Root cause turned out to be that the script was a symbolic link. Once replaced with a copy of the original, everything worked ...
gatopeich's user avatar
  • 121
2 votes

What's the easiest way to make my old init script work in systemd?

Tested on Debian: Add '_SYSTEMCTL_SKIP_REDIRECT=OHYES' at the start of the script. Systemd fanboys might not like it but hey, I don't like systemd, so there :).
Guy Egozy's user avatar
2 votes

RHEL4 script on shutdown

I've answered this sort of question before (hint: search my previous answers; I'm on a mobile currently), but the problem you are likely facing is that an init script will not be shutdown if a the ...
Cameron Kerr's user avatar
  • 4,119
2 votes

"reboot" or "shutdown -r now": what restart command is safer?

For modern RHEL you are recommended to use the systemctl command as summarised here: [recent] RHEL distributions should use the new systemctl command to issue poweroff/reboot. As stated in the ...
robocat's user avatar
  • 121
2 votes
Accepted

CentOS 7 Converting multiple process init script to systemd service

systemd does not support custom action names like install, it focuses on process management.
Mark Stosberg's user avatar

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