19/6/2014

Tot uw dienst: service

Filed under: — cybrarian @ 9:30 am

Systemd heeft overgenomen, en wordt aangesproken met systemctl (waar je vroeger /etc/init.d gebruikte).
Op de command prompt opstarten van een serverdienst met systemctl start prognaam.service (in de praktijk laat ik het deel .service er af, maar in principe hoort dat erbij):

  • Apache web server: systemctl start apache2
  • Databank mariadb: systemctl start mysql

Of ook met “service”:

  • Apache web server: service apache2 start
  • Databank mariadb: service mysql start

Checken hoe het zit met de diensten; wat gestart is bv:
service -s
Daar zie je de gestarte diensten, zoals bv:

apache2.service loaded active running The Apache Webserver

Hoe kan je de webserver (apache2) herstarten?
service apache2

Usage: /sbin/service apache2 {start|stop|reload|restart|try-restart|force-reload|status}

Zo kan je voor elke dienst opvragen hoe hij behandeld kan worden. Interessant is meestal hoe je de status van de lopende dienst kan bekijken:

service apache2 status

apache2.service – The Apache Webserver
Loaded: loaded (/usr/lib/systemd/system/apache2.service; disabled)
Active: active (running) since Thu 2014-06-19 09:28:33 CEST; 10min ago
Main PID: 2082 (httpd2-prefork)
Status: “Total requests: 0; Current requests/sec: 0; Current traffic: 0 B/sec”
CGroup: /system.slice/apache2.service
|-2082 /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf -D SYSTEMD -DFOREGROUND -k start
|-2099 /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf -D SYSTEMD -DFOREGROUND -k start
|-2100 /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf -D SYSTEMD -DFOREGROUND -k start
|-2102 /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf -D SYSTEMD -DFOREGROUND -k start
|-2104 /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf -D SYSTEMD -DFOREGROUND -k start
`-2105 /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf -D SYSTEMD -DFOREGROUND -k start

Jun 19 09:28:32 ProSuse131.loc start_apache2[2082]: AH00557: httpd2-prefork: apr_sockaddr_info_get() failed for ProSuse131.loc
Jun 19 09:28:32 ProSuse131.loc start_apache2[2082]: AH00558: httpd2-prefork: Could not reliably determine the server’s fully qualified domai…message
Jun 19 09:28:33 ProSuse131.loc systemd[1]: Started The Apache Webserver.
Hint: Some lines were ellipsized, use -l to show in full.

Nog eens hetzelfde voor de mysql/mariadb server:

service mysql start
service mysql status

mysql.service – LSB: Start the MySQL database server
Loaded: loaded (/etc/init.d/mysql)
Active: active (running) since Thu 2014-06-19 09:44:39 CEST; 10s ago
Process: 5778 ExecStart=/etc/init.d/mysql start (code=exited, status=0/SUCCESS)
CGroup: /system.slice/mysql.service
|-5848 /bin/sh /usr/bin/mysqld_safe –mysqld=mysqld –user=mysql –pid-file=/var/run/mysql/mysqld.pid –socket=/var/run/mysql/mysql.sock –d…
`-6062 /usr/sbin/mysqld –basedir=/usr –datadir=/var/lib/mysql –plugin-dir=/usr/lib64/mysql/plugin –user=mysql –log-error=/var/lib/mysql…

Jun 19 09:44:38 ProSuse131.loc systemd[1]: Starting LSB: Start the MySQL database server…
Jun 19 09:44:39 ProSuse131.loc mysql[5778]: Starting service MySQL ..done
Jun 19 09:44:39 ProSuse131.loc systemd[1]: Started LSB: Start the MySQL database server.

Reacties zijn gesloten.

Powered by WordPress