Would you like to be notified for every new articles? Please click HERE to subscribe for newsletter.

Starting and Stopping Service Manually In Slackware

  • Posted on: 28 August 2016
  • By: admin

Slackware has a very simple way to enable some system services to start automatically at system startup. As it said in the following documentation, Slackware is using BSD-style for its init system. All of the system initialization files are located at /etc/rc.d folder. When we want to enable a certain system service to start automatically, we just need to change the file mode into executable. For example, the Apache web server init file is rc.httpd. To make it start automatically on boot time, change the file mode using the following command.

cd /etc/rc.d
chmod 755 rc.httpd

To disable the service, use the following command.

cd /etc/rc.d
chmod 644 rc.httpd

Please remember, to enable, disable, start, or stop services, we must execute the command as root user.

It's that simple. But sometimes we want to start the service when it's needed only, or in other words, manually. We can do it by take a look at the content of the rc file of a certain service then find the command which is used to start or stop it. To start Apache web server manually, we can use this command.

apachectl -k start

And to stop it.

apachectl -k stop

Here is another example when we want to manage the MariaDB service. To start it, execute the following command.

mysqld_safe --datadir=/var/lib/mysql --pid-file=/var/run/mysql/mysql.pid &

And here is the command to stop it.

killall mysqld

See. All the commands can be various depend on the service. It's possible we can't remember them all, but there is a more common way so we don't have to take a look at the rc file content then remember many commands. Just execute bash command with the rc file name as the parameter.

bash /etc/rc.d/rc.httpd start
bash /etc/rc.d/rc.mysqld start
bash /etc/rc.d/rc.sshd start

The command above will start the Apache, MariaDB, and SSH Server. To stop them just use the following command.

bash /etc/rc.d/rc.httpd stop
bash /etc/rc.d/rc.mysqld stop
bash /etc/rc.d/rc.sshd stop

Why don't we just execute /etc/rc.d/rc.httpd start and so on? In order to do that, we need to change the file mode to be executable which means that service will be started automatically and we don't want that in this case.

Add new comment

Limited HTML

  • Allowed HTML tags: <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
By submitting this form, you accept the Mollom privacy policy.