En todos los sistemas GNU/Linux existe lo que se conoce como runlevels, que no son más que las diferentes formas que tiene de arrancar el sistema operativo y según la que se elija se pueden tener unos u otras servicios en ejecución. En sistemas Debian, la forma modificar los servicios que se arrancan y para en cada runlevel es con el comando update-rc.d y en sistemas Red Hat, el comando empleado es chkconfig.
En este post vamos a ver un poco más detallada la forma que tiene de trabajar dicho comando y cómo poder usarlo, para saber los programas que se arrancan en cada nivel y también cómo hacer que se arranque un nuevo servicio en un nivel o se para otro.
Para obtener un listado de los servicios que se arrancan, así como del estado de los mismos en función de los diferentes 7 runlevel's del sistema,
shell> chkconfig --list atop 0:off 1:off 2:off 3:off 4:off 5:off 6:off auditd 0:off 1:off 2:on 3:on 4:on 5:on 6:off bacula-fd 0:off 1:off 2:off 3:off 4:off 5:off 6:off crond 0:off 1:off 2:on 3:on 4:on 5:on 6:off ip6tables 0:off 1:off 2:on 3:on 4:on 5:on 6:off iptables 0:off 1:off 2:on 3:on 4:on 5:on 6:off lvm2-monitor 0:off 1:on 2:on 3:on 4:on 5:on 6:off netconsole 0:off 1:off 2:off 3:off 4:off 5:off 6:off netfs 0:off 1:off 2:off 3:on 4:on 5:on 6:off network 0:off 1:off 2:on 3:on 4:on 5:on 6:off ntpd 0:off 1:off 2:off 3:off 4:off 5:off 6:off ntpdate 0:off 1:off 2:off 3:off 4:off 5:off 6:off postfix 0:off 1:off 2:on 3:on 4:on 5:on 6:off puppet 0:off 1:off 2:off 3:off 4:off 5:off 6:off rdisc 0:off 1:off 2:off 3:off 4:off 5:off 6:off restorecond 0:off 1:off 2:off 3:off 4:off 5:off 6:off rsyslog 0:off 1:off 2:on 3:on 4:on 5:on 6:off saslauthd 0:off 1:off 2:off 3:off 4:off 5:off 6:off sshd 0:off 1:off 2:on 3:on 4:on 5:on 6:off sysstat 0:off 1:on 2:on 3:on 4:on 5:on 6:off udev-post 0:off 1:on 2:on 3:on 4:on 5:on 6:off zabbix-agent 0:off 1:off 2:off 3:off 4:off 5:off 6:off
La forma que existe de alterar estos servicios en los diferentes niveles por lo tanto, es la siguiente,
shell> chkconfig --level [0123456] serviceon shell> chkconfig --level [0123456] service off shell> chkconfig --add service shell> chkconfig --del service
Como se puede observar existen 3 formas diferentes de hacerlo, la primera es indicando el/los level para el que se quiere arrancar o parar el servicio y la segunda es dejar que sea el propio chkconfig el que elija los niveles por defecto en los que arrancar un servicio o pararlo.
Por ejemplo, si nos interesa arrancar el servicio puppet en los level 3, 4 y 5, ejecutaremos el siguiente comando,
shell> chkconfig --level 35 puppet on
Sin embargo, si dejamos que sea el propio comando el que elija en qué niveles arrancar por defecto, nos los arrancaría en el 2, 3, 4 y 5 y el comando sería, tal que así,
shell> chkconfig --add puppet
Si ahora volvemos a ejecutar el listado, podremos observar cómo ejecutivamente el servicio puppet ha cambiado y al reiniciar el equipo, éste arrancará por defecto si entramos en alguno de esos runlevel's.
shell> chkconfig --list atop 0:off 1:off 2:off 3:off 4:off 5:off 6:off auditd 0:off 1:off 2:on 3:on 4:on 5:on 6:off bacula-fd 0:off 1:off 2:off 3:off 4:off 5:off 6:off crond 0:off 1:off 2:on 3:on 4:on 5:on 6:off ip6tables 0:off 1:off 2:on 3:on 4:on 5:on 6:off iptables 0:off 1:off 2:on 3:on 4:on 5:on 6:off lvm2-monitor 0:off 1:on 2:on 3:on 4:on 5:on 6:off netconsole 0:off 1:off 2:off 3:off 4:off 5:off 6:off netfs 0:off 1:off 2:off 3:on 4:on 5:on 6:off network 0:off 1:off 2:on 3:on 4:on 5:on 6:off ntpd 0:off 1:off 2:off 3:off 4:off 5:off 6:off ntpdate 0:off 1:off 2:off 3:off 4:off 5:off 6:off postfix 0:off 1:off 2:on 3:on 4:on 5:on 6:off puppet 0:off 1:off 2:off 3:on 4:off 5:on 6:off rdisc 0:off 1:off 2:off 3:off 4:off 5:off 6:off restorecond 0:off 1:off 2:off 3:off 4:off 5:off 6:off rsyslog 0:off 1:off 2:on 3:on 4:on 5:on 6:off saslauthd 0:off 1:off 2:off 3:off 4:off 5:off 6:off sshd 0:off 1:off 2:on 3:on 4:on 5:on 6:off sysstat 0:off 1:on 2:on 3:on 4:on 5:on 6:off udev-post 0:off 1:on 2:on 3:on 4:on 5:on 6:off zabbix-agent 0:off 1:off 2:off 3:off 4:off 5:off 6:off
No hay comentarios :
Publicar un comentario