{"id":11044,"date":"2016-06-15T14:01:47","date_gmt":"2016-06-15T17:01:47","guid":{"rendered":"https:\/\/cleuber.com.br\/?p=11044"},"modified":"2016-06-17T14:27:59","modified_gmt":"2016-06-17T17:27:59","slug":"init-vs-systemd","status":"publish","type":"post","link":"https:\/\/cleuber.com.br\/index.php\/2016\/06\/15\/init-vs-systemd","title":{"rendered":"SysVinit Vs Systemd"},"content":{"rendered":"<h2>O Que \u00e9 o Init?<\/h2>\n<p>No Linux, o <span style=\"text-decoration: underline; color: #3366ff;\"><a style=\"color: #3366ff;\" href=\"https:\/\/pt.wikipedia.org\/wiki\/Init\" target=\"_blank\"><strong>init<\/strong><\/a><\/span> \u00e9 uma abreviatura para Inicializa\u00e7\u00e3o. O init \u00e9 um processo <span style=\"text-decoration: underline;\"><span style=\"color: #3366ff;\"><a style=\"color: #3366ff; text-decoration: underline;\" href=\"https:\/\/pt.wikipedia.org\/wiki\/Daemon_(computa\u00e7\u00e3o)\" target=\"_blank\">daemon<\/a><\/span><\/span>, que come\u00e7a assim que o computador \u00e9 iniciado e continuar a executar at\u00e9 o desligamento. De\u00a0fato, o init \u00e9 o primeiro processo que come\u00e7a quando um computador \u00e9 iniciado, tornando-se o pai de todos os outros processos em execu\u00e7\u00e3o direta ou indiretamente e, portanto, normalmente \u00e9 atribu\u00eddo &#8220;pid = 1&#8221;.<\/p>\n<p>Se de alguma forma o daemon do init n\u00e3o iniciar, nenhum processo ser\u00e1 iniciado e o sistema ir\u00e1 chegar a uma fase chamada <strong>&#8220;Kernel Panic&#8221;<\/strong>. O init \u00e9 mais comumente referido como System V Init. Sistema V \u00e9 o primeiro sistema operacional UNIX comercial projetado e usos do init e a maior parte das distribui\u00e7\u00f5es Linux de hoje s\u00e3o id\u00eanticas ao System V OS com algumas exce\u00e7\u00f5es, como Slackware usando BSD-estyle e Gentoo usando o init personalizado.<\/p>\n<h3>Substitutos do Init<\/h3>\n<p>A necessidade de substituir o init por\u00a0algo melhor\u00a0foi sentida a partir de um longo tempo e v\u00e1rias alternativas foram desenvolvidas, de tempos em tempos, algumas das quais se tornaram substitutas para a inicializa\u00e7\u00e3o nativa de distribui\u00e7\u00e3o, alguns dos quais s\u00e3o:<\/p>\n<p><a href=\"https:\/\/pt.wikipedia.org\/wiki\/Upstart\" target=\"_blank\"><strong>Upstart<\/strong><\/a> &#8211; Um daemon de substitui\u00e7\u00e3o de init implementado no Ubuntu GNU \/ Linux e projetado para iniciar o processo de forma ass\u00edncrona.<br \/>\n<strong>Epoch<\/strong> &#8211; Um daemon de substitui\u00e7\u00e3o de init constru\u00eddo em torno de simplicidade de gest\u00e3o e servi\u00e7o, projetado para iniciar o processo de single-threaded.<br \/>\n<strong>Mudar<\/strong> &#8211; Um daemon de substitui\u00e7\u00e3o de inicializa\u00e7\u00e3o escrito em Python, implementado em Pardus GNU \/ Linux e projetado para iniciar o processo de forma ass\u00edncrona.<br \/>\n<strong><a style=\"text-decoration: underline;\" href=\"https:\/\/pt.wikipedia.org\/wiki\/Systemd\" target=\"_blank\">Systemd<\/a><\/strong> &#8211; Um daemon de substitui\u00e7\u00e3o de init projetado para processar em paralelo, implementado em uma s\u00e9rie de distribui\u00e7\u00e3o padr\u00e3o &#8211; Fedora, openSUSE, a Arch, RHEL, CentOS, e recentemente o Ubuntu.<br \/>\n<a href=\"https:\/\/wiki.gentoo.org\/wiki\/OpenRC\" target=\"_blank\"><strong>OpenRC<\/strong><\/a> &#8211; Um substituto do init e baseado nele criado por e para o Gentoo.<\/p>\n<p><em><strong>Obs.<\/strong> Inclusive, se voc\u00ea usa o Ubuntu, (acima da vers\u00e3o 15.10), j\u00e1 notou, no grub, existe, desde ent\u00e3o, a op\u00e7\u00e3o de &#8220;upstart&#8221;, que \u00e9 a op\u00e7\u00e3o caso voc\u00ea queira usar o upstart\u00a0novamente ao inv\u00e9s do atual systemd.<\/em><\/p>\n<h4><a href=\"https:\/\/i0.wp.com\/cleuber.com.br\/wp-content\/uploads\/2016\/06\/upstart.jpg?ssl=1\"><img data-recalc-dims=\"1\" decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-11043\" src=\"https:\/\/i0.wp.com\/cleuber.com.br\/wp-content\/uploads\/2016\/06\/upstart.jpg?resize=309%2C112&#038;ssl=1\" alt=\"upstart\" width=\"309\" height=\"112\" srcset=\"https:\/\/i0.wp.com\/cleuber.com.br\/wp-content\/uploads\/2016\/06\/upstart.jpg?resize=1024%2C372&amp;ssl=1 1024w, https:\/\/i0.wp.com\/cleuber.com.br\/wp-content\/uploads\/2016\/06\/upstart.jpg?resize=300%2C109&amp;ssl=1 300w, https:\/\/i0.wp.com\/cleuber.com.br\/wp-content\/uploads\/2016\/06\/upstart.jpg?resize=768%2C279&amp;ssl=1 768w, https:\/\/i0.wp.com\/cleuber.com.br\/wp-content\/uploads\/2016\/06\/upstart.jpg?w=1554&amp;ssl=1 1554w\" sizes=\"auto, (max-width: 309px) 100vw, 309px\" \/><\/a><\/h4>\n<h2>O que \u00e9 o Systemd?<\/h2>\n<p>O\u00a0<strong><span style=\"text-decoration: underline; color: #3366ff;\"><a style=\"color: #3366ff; text-decoration: underline;\" href=\"https:\/\/pt.wikipedia.org\/wiki\/Systemd\" target=\"_blank\">systemd<\/a><\/span><\/strong> \u00e9 um Daemon de Sistema de Gest\u00e3o de chamada com a conven\u00e7\u00e3o UNIX para adicionar a letra &#8216;d&#8217; no final para indicar que \u00e9 um daemon\u00a0para\u00a0ser facilmente reconhecida. Inicialmente, ele foi liberado sob a licen\u00e7a GNU General Public License, mas agora os lan\u00e7amentos s\u00e3o feitos sob a GNU Lesser General Public License. Similar ao init, systemd \u00e9 o pai de todos os outros processos direta ou indiretamente, e \u00e9 o primeiro processo que come\u00e7a na inicializa\u00e7\u00e3o, portanto, tipicamente atribu\u00eddo um<\/p>\n<p>um &#8220;pid = 1&#8221;.<\/p>\n<p>Ele foi projetado para superar as defici\u00eancias de inicializa\u00e7\u00e3o. \u00c9 em si \u00e9 um processo em segundo plano que \u00e9 projetado para iniciar processos em paralelo, reduzindo assim o tempo de inicializa\u00e7\u00e3o e sobrecarga computacional. Tem muitos\u00a0outros recursos, em compara\u00e7\u00e3o com o init.<\/p>\n<h3>Por que houve a necessidade de substituir o init?<\/h3>\n<p>O init inicia um processo em\u00a0s\u00e9rie, ou seja, uma tarefa s\u00f3 come\u00e7a depois que\u00a0a execu\u00e7\u00e3o da \u00faltima tarefa foi bem sucedida e ela foi carregada na mem\u00f3ria. Isso muitas vezes resultou em tempo de inicializa\u00e7\u00e3o mais longo.<\/p>\n<h4>Caracter\u00edsticas do systemd<\/h4>\n<ul>\n<li>Limpo, stateforward e design eficiente.<\/li>\n<li>Simples processo de inicializa\u00e7\u00e3o.<\/li>\n<li>Processamento simult\u00e2neo e em paralelo durante o boot.<\/li>\n<li>Melhor API.<\/li>\n<li>Unidade simples Syntax.<\/li>\n<li>Capacidade de remover componentes opcionais.<\/li>\n<li>Uso\u00a0de pouca mem\u00f3ria.<\/li>\n<li>T\u00e9cnica melhorada para expressar depend\u00eancias.<\/li>\n<li>Instru\u00e7\u00e3o de inicializa\u00e7\u00e3o escrito no arquivo de configura\u00e7\u00e3o e n\u00e3o em shell script.<\/li>\n<li>Faz uso de Dom\u00ednio Unix Socket.<\/li>\n<li>Agendamento de trabalho usando Timers agendados do Systemd.<\/li>\n<li>Registro de Eventos com journald.<\/li>\n<li>Escolha de eventos de log do sistema com systemd, bem como syslog.<\/li>\n<li>Os registros s\u00e3o armazenados em arquivo bin\u00e1rio.<\/li>\n<li>Estado systemd pode ser preservado para ser chamado mais tarde no futuro.<\/li>\n<li>Processo de faixa utilizando cgroup do kernel e n\u00e3o PID.<\/li>\n<li>Login de usu\u00e1rios gerido por systemd-logind.<\/li>\n<li>Melhor integra\u00e7\u00e3o com o Gnome para a interoperabilidade.<\/li>\n<\/ul>\n<p>Distros Que Usam Systemd<\/p>\n<table style=\"width: 602px;\" border=\"0\" cellspacing=\"0\">\n<colgroup width=\"150\"><\/colgroup>\n<colgroup width=\"500\"><\/colgroup>\n<tbody>\n<tr>\n<td style=\"width: 146px;\" align=\"CENTER\" height=\"19\"><b>Linux Distribution<\/b><\/td>\n<td style=\"width: 448px;\" align=\"CENTER\"><b>Integration<\/b><\/td>\n<\/tr>\n<tr class=\"alt\">\n<td style=\"width: 146px;\" align=\"LEFT\" height=\"19\">Fedora<\/td>\n<td style=\"width: 448px;\" align=\"LEFT\">Sim, primeira a adot\u00e1-la<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 146px;\" align=\"LEFT\" height=\"16\">Arch<\/td>\n<td style=\"width: 448px;\" align=\"LEFT\">Sim<\/td>\n<\/tr>\n<tr class=\"alt\">\n<td style=\"width: 146px;\" align=\"LEFT\" height=\"19\">RedHat<\/td>\n<td style=\"width: 448px;\" align=\"LEFT\">Sim<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 146px;\" align=\"LEFT\" height=\"19\">CentOS<\/td>\n<td style=\"width: 448px;\" align=\"LEFT\">Sim<\/td>\n<\/tr>\n<tr class=\"alt\">\n<td style=\"width: 146px;\" align=\"LEFT\" height=\"19\">Debian<\/td>\n<td style=\"width: 448px;\" align=\"LEFT\">Sim, desde o Debian 8 Jessie<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 146px;\" align=\"LEFT\" height=\"19\">Gentoo<\/td>\n<td style=\"width: 448px;\" align=\"LEFT\">Sim,\u00a0removeu o OpenRC e passou a utilizar tamb\u00e9m o systemd.<\/td>\n<\/tr>\n<tr class=\"alt\">\n<td style=\"width: 146px;\" align=\"LEFT\" height=\"19\">OpenSUSE<\/td>\n<td style=\"width: 448px;\" align=\"LEFT\">Sim<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 146px;\" align=\"LEFT\" height=\"19\">Slack<\/td>\n<td style=\"width: 448px;\" align=\"LEFT\">N\u00e3o (at\u00e9 onde eu sei)<\/td>\n<\/tr>\n<tr class=\"alt\">\n<td style=\"width: 146px;\" align=\"LEFT\" height=\"16\">Ubuntu<\/td>\n<td style=\"width: 448px;\" align=\"LEFT\">Sim, desde o 15.10<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<p>Para saber qual seu sistema est\u00e1 usando, voc\u00ea pode usar este comando:<\/p>\n<pre><code>readlink \/sbin\/init<\/code><\/pre>\n<p>Estou no momento usando o Ubuntu Gnome 16.04 e a minha sa\u00edda veio:<\/p>\n<p><a href=\"https:\/\/i0.wp.com\/cleuber.com.br\/wp-content\/uploads\/2016\/06\/init-comand.png?ssl=1\"><img data-recalc-dims=\"1\" decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-11061\" src=\"https:\/\/i0.wp.com\/cleuber.com.br\/wp-content\/uploads\/2016\/06\/init-comand.png?resize=476%2C166&#038;ssl=1\" alt=\"init-comand\" width=\"476\" height=\"166\" srcset=\"https:\/\/i0.wp.com\/cleuber.com.br\/wp-content\/uploads\/2016\/06\/init-comand.png?w=476&amp;ssl=1 476w, https:\/\/i0.wp.com\/cleuber.com.br\/wp-content\/uploads\/2016\/06\/init-comand.png?resize=300%2C105&amp;ssl=1 300w\" sizes=\"auto, (max-width: 476px) 100vw, 476px\" \/><\/a><\/p>\n<p>Outro comando bacana para visualizar a \u00e1rvore de processos \u00e9 o simples <strong>pstree<\/strong>.<\/p>\n<p>Repare na imagem abaixo como no meu caso o systemd est\u00e1 \u00e9 o processo pai e est\u00e1 gerenciando todos.<\/p>\n<p><a href=\"https:\/\/i0.wp.com\/cleuber.com.br\/wp-content\/uploads\/2016\/06\/Captura-de-tela-de-2016-06-17-08-30-22.png?ssl=1\"><img data-recalc-dims=\"1\" decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-11091\" src=\"https:\/\/i0.wp.com\/cleuber.com.br\/wp-content\/uploads\/2016\/06\/Captura-de-tela-de-2016-06-17-08-30-22.png?resize=478%2C617&#038;ssl=1\" alt=\"Captura de tela de 2016-06-17 08-30-22\" width=\"478\" height=\"617\" srcset=\"https:\/\/i0.wp.com\/cleuber.com.br\/wp-content\/uploads\/2016\/06\/Captura-de-tela-de-2016-06-17-08-30-22.png?w=786&amp;ssl=1 786w, https:\/\/i0.wp.com\/cleuber.com.br\/wp-content\/uploads\/2016\/06\/Captura-de-tela-de-2016-06-17-08-30-22.png?resize=232%2C300&amp;ssl=1 232w, https:\/\/i0.wp.com\/cleuber.com.br\/wp-content\/uploads\/2016\/06\/Captura-de-tela-de-2016-06-17-08-30-22.png?resize=768%2C992&amp;ssl=1 768w\" sizes=\"auto, (max-width: 478px) 100vw, 478px\" \/><\/a><\/p>\n<h2>Systemd Vs Init<\/h2>\n<table style=\"width: 602px;\" border=\"0\" cellspacing=\"0\">\n<colgroup width=\"372\"><\/colgroup>\n<colgroup width=\"137\"><\/colgroup>\n<colgroup width=\"481\"><\/colgroup>\n<tbody>\n<tr style=\"height: 24px;\">\n<td style=\"width: 280px; height: 24px;\" align=\"CENTER\"><b>Caracter\u00edsticas<\/b><\/td>\n<td style=\"width: 187px; height: 24px;\" align=\"CENTER\"><b>Init<\/b><\/td>\n<td style=\"width: 127px; height: 24px;\" align=\"CENTER\"><b>systemd<\/b><\/td>\n<\/tr>\n<tr class=\"alt\" style=\"height: 24px;\">\n<td style=\"width: 280px; height: 24px;\" align=\"LEFT\">DBus Depend\u00eancia &#8211; Obrigat\u00f3rio<\/td>\n<td style=\"width: 187px; text-align: center; height: 24px;\" align=\"LEFT\">N\u00e3o<\/td>\n<td style=\"width: 127px; text-align: center; height: 24px;\" align=\"LEFT\">sim<\/td>\n<\/tr>\n<tr style=\"height: 24.4688px;\">\n<td style=\"width: 280px; height: 24.4688px;\" align=\"LEFT\">Ativa\u00e7\u00e3o baseada dispositivo<\/td>\n<td style=\"width: 187px; text-align: center; height: 24.4688px;\" align=\"LEFT\">N\u00e3o<\/td>\n<td style=\"width: 127px; text-align: center; height: 24.4688px;\" align=\"LEFT\">sim<\/td>\n<\/tr>\n<tr class=\"alt\" style=\"height: 48px;\">\n<td style=\"width: 280px; height: 48px;\" align=\"LEFT\">configura\u00e7\u00e3o de depend\u00eancia de dispositivos com udev<\/td>\n<td style=\"width: 187px; text-align: center; height: 48px;\" align=\"LEFT\">N\u00e3o<\/td>\n<td style=\"width: 127px; text-align: center; height: 48px;\" align=\"LEFT\">sim<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"width: 280px; height: 24px;\" align=\"LEFT\">Ativa\u00e7\u00e3o baseada temporizador<\/td>\n<td style=\"width: 187px; text-align: center; height: 24px;\" align=\"LEFT\">Cron\/at<\/td>\n<td style=\"width: 127px; text-align: center; height: 24px;\" align=\"LEFT\">propriet\u00e1rio<\/td>\n<\/tr>\n<tr class=\"alt\" style=\"height: 24px;\">\n<td style=\"width: 280px; height: 24px;\" align=\"LEFT\">Gest\u00e3o de Quotas<\/td>\n<td style=\"width: 187px; text-align: center; height: 24px;\" align=\"LEFT\">N\u00e3o<\/td>\n<td style=\"width: 127px; text-align: center; height: 24px;\" align=\"LEFT\">sim<\/td>\n<\/tr>\n<tr style=\"height: 48px;\">\n<td style=\"width: 280px; height: 48px;\" align=\"LEFT\">Manipula\u00e7\u00e3o autom\u00e1tica de depend\u00eancia de servi\u00e7o<\/td>\n<td style=\"width: 187px; text-align: center; height: 48px;\" align=\"LEFT\">N\u00e3o<\/td>\n<td style=\"width: 127px; text-align: center; height: 48px;\" align=\"LEFT\">sim<\/td>\n<\/tr>\n<tr class=\"alt\" style=\"height: 48px;\">\n<td style=\"width: 280px; height: 48px;\" align=\"LEFT\">Mata usu\u00e1rios Processo no logout<\/td>\n<td style=\"width: 187px; text-align: center; height: 48px;\" align=\"LEFT\">N\u00e3o<\/td>\n<td style=\"width: 127px; text-align: center; height: 48px;\" align=\"LEFT\">sim<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"width: 280px; height: 24px;\" align=\"LEFT\">Gest\u00e3o de swap<\/td>\n<td style=\"width: 187px; text-align: center; height: 24px;\" align=\"LEFT\">N\u00e3o<\/td>\n<td style=\"width: 127px; text-align: center; height: 24px;\" align=\"LEFT\">sim<\/td>\n<\/tr>\n<tr class=\"alt\" style=\"height: 24px;\">\n<td style=\"width: 280px; height: 24px;\" align=\"LEFT\">integra\u00e7\u00e3o SELinux<\/td>\n<td style=\"width: 187px; text-align: center; height: 24px;\" align=\"LEFT\">N\u00e3o<\/td>\n<td style=\"width: 127px; text-align: center; height: 24px;\" align=\"LEFT\">sim<\/td>\n<\/tr>\n<tr style=\"height: 48px;\">\n<td style=\"width: 280px; height: 48px;\" align=\"LEFT\">Suporte para criptografados HDD<\/td>\n<td style=\"width: 187px; text-align: center; height: 48px;\" align=\"LEFT\">N\u00e3o<\/td>\n<td style=\"width: 127px; text-align: center; height: 48px;\" align=\"LEFT\">sim<\/td>\n<\/tr>\n<tr class=\"alt\" style=\"height: 24px;\">\n<td style=\"width: 280px; height: 24px;\" align=\"LEFT\">Est\u00e1tica kernle m\u00f3dulo de carga<\/td>\n<td style=\"width: 187px; text-align: center; height: 24px;\" align=\"LEFT\">N\u00e3o<\/td>\n<td style=\"width: 127px; text-align: center; height: 24px;\" align=\"LEFT\">sim<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"width: 280px; height: 24px;\" align=\"LEFT\">GUI<\/td>\n<td style=\"width: 187px; text-align: center; height: 24px;\" align=\"LEFT\">N\u00e3o<\/td>\n<td style=\"width: 127px; text-align: center; height: 24px;\" align=\"LEFT\">sim<\/td>\n<\/tr>\n<tr class=\"alt\" style=\"height: 24px;\">\n<td style=\"width: 280px; height: 24px;\" align=\"LEFT\">Listar todos os processos filhos<\/td>\n<td style=\"width: 187px; text-align: center; height: 24px;\" align=\"LEFT\">N\u00e3o<\/td>\n<td style=\"width: 127px; text-align: center; height: 24px;\" align=\"LEFT\">sim<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"width: 280px; height: 24px;\" align=\"LEFT\">sysv compat\u00edvel<\/td>\n<td style=\"width: 187px; text-align: center; height: 24px;\" align=\"LEFT\">sim<\/td>\n<td style=\"width: 127px; text-align: center; height: 24px;\" align=\"LEFT\">sim<\/td>\n<\/tr>\n<tr class=\"alt\" style=\"height: 24px;\">\n<td style=\"width: 280px; height: 24px;\" align=\"LEFT\">inicializa\u00e7\u00e3o interativo<\/td>\n<td style=\"width: 187px; text-align: center; height: 24px;\" align=\"LEFT\">N\u00e3o<\/td>\n<td style=\"width: 127px; text-align: center; height: 24px;\" align=\"LEFT\">sim<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"width: 280px; height: 24px;\" align=\"LEFT\">Port\u00e1til para n\u00e3o x86<\/td>\n<td style=\"width: 187px; text-align: center; height: 24px;\" align=\"LEFT\">Sim<\/td>\n<td style=\"width: 127px; text-align: center; height: 24px;\" align=\"LEFT\">N\u00e3o<\/td>\n<\/tr>\n<tr class=\"alt\" style=\"height: 48px;\">\n<td style=\"width: 280px; height: 48px;\" align=\"LEFT\">Adotada em<\/td>\n<td style=\"width: 187px; text-align: center; height: 48px;\" align=\"LEFT\">v\u00e1rias Distros<\/td>\n<td style=\"width: 127px; text-align: center; height: 48px;\" align=\"LEFT\">v\u00e1rias Distros<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"width: 280px; height: 24px;\" align=\"LEFT\">inicializa\u00e7\u00e3o do servi\u00e7o paralelo<\/td>\n<td style=\"width: 187px; text-align: center; height: 24px;\" align=\"LEFT\">N\u00e3o<\/td>\n<td style=\"width: 127px; text-align: center; height: 24px;\" align=\"LEFT\">sim<\/td>\n<\/tr>\n<tr class=\"alt\" style=\"height: 24px;\">\n<td style=\"width: 280px; height: 24px;\" align=\"LEFT\">limite de recursos por servi\u00e7o<\/td>\n<td style=\"width: 187px; text-align: center; height: 24px;\" align=\"LEFT\">N\u00e3o<\/td>\n<td style=\"width: 127px; text-align: center; height: 24px;\" align=\"LEFT\">sim<\/td>\n<\/tr>\n<tr style=\"height: 48px;\">\n<td style=\"width: 280px; height: 48px;\" align=\"LEFT\">script de inicializa\u00e7\u00e3o extens\u00edvel f\u00e1cil<\/td>\n<td style=\"width: 187px; text-align: center; height: 48px;\" align=\"LEFT\">sim<\/td>\n<td style=\"width: 127px; text-align: center; height: 48px;\" align=\"LEFT\">N\u00e3o<\/td>\n<\/tr>\n<tr class=\"alt\" style=\"height: 48px;\">\n<td style=\"width: 280px; height: 48px;\" align=\"LEFT\">C\u00f3digo separado e Arquivo de Configura\u00e7\u00e3o<\/td>\n<td style=\"width: 187px; text-align: center; height: 48px;\" align=\"LEFT\">sim<\/td>\n<td style=\"width: 127px; text-align: center; height: 48px;\" align=\"LEFT\">N\u00e3o<\/td>\n<\/tr>\n<tr style=\"height: 48px;\">\n<td style=\"width: 280px; height: 48px;\" align=\"LEFT\">c\u00e1lculo autom\u00e1tica de depend\u00eancia<\/td>\n<td style=\"width: 187px; text-align: center; height: 48px;\" align=\"LEFT\">N\u00e3o<\/td>\n<td style=\"width: 127px; text-align: center; height: 48px;\" align=\"LEFT\">sim<\/td>\n<\/tr>\n<tr class=\"alt\" style=\"height: 24px;\">\n<td style=\"width: 280px; height: 24px;\" align=\"LEFT\">depura\u00e7\u00e3o verboso<\/td>\n<td style=\"width: 187px; text-align: center; height: 24px;\" align=\"LEFT\">sim<\/td>\n<td style=\"width: 127px; text-align: center; height: 24px;\" align=\"LEFT\">N\u00e3o<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"width: 280px; height: 24px;\" align=\"LEFT\">Vers\u00e3o<\/td>\n<td style=\"width: 187px; text-align: center; height: 24px;\" align=\"LEFT\">N \/ D<\/td>\n<td style=\"width: 127px; text-align: center; height: 24px;\" align=\"LEFT\">V44 +<\/td>\n<\/tr>\n<tr class=\"alt\" style=\"height: 24px;\">\n<td style=\"width: 280px; height: 24px;\" align=\"LEFT\">Tamanho<\/td>\n<td style=\"width: 187px; text-align: center; height: 24px;\" align=\"LEFT\">560 KB<\/td>\n<td style=\"width: 127px; text-align: center; height: 24px;\" align=\"LEFT\">N\/D<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"width: 280px; height: 24px;\" align=\"LEFT\">N\u00famero de Arquivos<\/td>\n<td style=\"width: 187px; text-align: center; height: 24px;\" align=\"LEFT\">75 arquivos<\/td>\n<td style=\"width: 127px; text-align: center; height: 24px;\" align=\"LEFT\">900 arquivos + glib + DBus<\/td>\n<\/tr>\n<tr class=\"alt\" style=\"height: 72px;\">\n<td style=\"width: 280px; height: 72px;\" align=\"LEFT\">Linhas de c\u00f3digo &#8211; LOC<\/td>\n<td style=\"width: 187px; text-align: center; height: 72px;\" align=\"LEFT\">15000 (aprox)<\/td>\n<td style=\"width: 127px; text-align: center; height: 72px;\" align=\"LEFT\">224000 (aprox) (c\u00f3digos inc, coment\u00e1rios e espa\u00e7o em branco) 125000 (aprox) (c\u00f3digo acctual)<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>Comparativo Entre os Comandos Para Gerenciar Servi\u00e7os no SysVinit e Comandos do Systemd<\/h3>\n<p>Como sabemos, os dois n\u00e3o apenas gerenciam todos os servi\u00e7os que se iniciam durante o boot, mas tamb\u00e9m continuam em execu\u00e7\u00e3o o tempo todo enquanto voc\u00ea utiliza a m\u00e1quina. E atrav\u00e9s deles, voc\u00ea pode gerenciar os servi\u00e7os em execu\u00e7\u00e3o, ou tornar um programa em um servi\u00e7o ou daemon.<\/p>\n<p>Ent\u00e3o, abaixo uma lista de comandos para gerenciar servi\u00e7os com o SysVinit e no Systemd.<\/p>\n<p>Vamos imaginar o servi\u00e7o foo, ent\u00e3o vamos l\u00e1:<\/p>\n<table style=\"width: 645px;\" border=\"1\" cellspacing=\"0\">\n<tbody>\n<tr>\n<th style=\"width: 210px;\">Como era no SysVinit<\/th>\n<th style=\"width: 221px;\">Como \u00e9 no systemd<\/th>\n<th style=\"width: 206px;\">observa\u00e7\u00f5es<\/th>\n<\/tr>\n<tr>\n<td style=\"width: 210px;\">\/etc\/init.d\/foo start\/etc\/init.d\/foo stop<\/td>\n<td style=\"width: 221px;\">systemctl start foosystemctl stop\u00a0foo<\/td>\n<td style=\"width: 206px;\">Inicia um servi\u00e7o\/Para um servi\u00e7o<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 210px;\">tail -f \/var\/log\/messages<\/td>\n<td style=\"width: 221px;\">journalctl -f<\/td>\n<td style=\"width: 206px;\">Centralizando a leitura dos eventos de logs principais, lembrando que ele esta capturando todos os registros de logs como as facilities e prioridades.<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 210px;\">\/etc\/init.d\/foo restart<\/td>\n<td style=\"width: 221px;\">systemctl restart foo<\/td>\n<td style=\"width: 206px;\">Reinicia o servi\u00e7o<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 210px;\">\/etc\/init.d\/foo reload<\/td>\n<td style=\"width: 221px;\">systemctl reload\u00a0foo<\/td>\n<td style=\"width: 206px;\">Reinicia o servi\u00e7o, recarregando apenas o arquivo de configura\u00e7\u00e3o, validando sem interromper o servi\u00e7o em execu\u00e7\u00e3o.<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 210px;\">\/etc\/init.d\/foo status<\/td>\n<td style=\"width: 221px;\">systemctl status foosystemctl status foo.service<\/p>\n<p>(voce n\u00e3o precisa colocar o .service)<\/td>\n<td style=\"width: 206px;\">Reinicia o servi\u00e7o<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 210px;\">who -r<\/td>\n<td style=\"width: 221px;\">systemctl get-default<\/td>\n<td style=\"width: 206px;\">Verifica a runlevel que esta conectada. No systemd voc\u00ea possui apenas 2 *teoricamente, sendo\u00a0multi-user.target para boot apenas em modo texto e\u00a0graphical.target para modo grafico. \u00c9 poss\u00edvel alterar a runlevel para o proximo boot com o comando\u00a0systemctl set-default &lt;coloque aqui qual voce quer&gt;.target<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 210px;\">ls \/etc\/rc.d\/init.d\/<\/p>\n<p>initctl list (no upstart)<\/p>\n<p>ou<\/p>\n<p>service &#8211;status-all<\/td>\n<td style=\"width: 221px;\">systemctl list-unit-files<\/td>\n<td style=\"width: 206px;\">Lista todos os servi\u00e7os que existem no seu sistema. E informa quem est\u00e1 ativo ou desabilitado.<\/p>\n<p>obs. Use o &#8220;q&#8221; para sair.<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 210px;\">chkconfig foo\u00a0on<\/td>\n<td style=\"width: 221px;\">systemctl enable foo<\/td>\n<td style=\"width: 206px;\">Habilita\u00a0o servi\u00e7o das runlevels 2345 para o proximo boot.\u00a0(voce n\u00e3o precisa colocar o .service)<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 210px;\">chkconfig foo\u00a0off<\/td>\n<td style=\"width: 221px;\">systemctl disable foo.<\/td>\n<td style=\"width: 206px;\">Desabilita o servi\u00e7o das runlevels 2345 para o proximo boot.\u00a0\u00a0(voce n\u00e3o precisa colocar o .service)<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 210px;\">chkconfig foo<\/p>\n<p>(o que pode ser visualizado pelo pr\u00f3prio status direto no daemon)<\/td>\n<td style=\"width: 221px;\">systemctl is-enabled foo<\/td>\n<td style=\"width: 206px;\">Utilizado par verificar se o servi\u00e7o esta ativo ou n\u00e3o. Qual o status do servi\u00e7o. Voce nao precisa colocar o .service, como antes.<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 210px;\">\n<pre>chkconfig --list<\/pre>\n<\/td>\n<td style=\"width: 221px;\">systemctl -t service (mais completo)<\/td>\n<td style=\"width: 206px;\">Exibe todos os servi\u00e7os que est\u00e3o vinculados aos n\u00edveis de execu\u00e7\u00e3o do systemd, seja multi-user (antiga runlevel 3) ou graphic-user (antiga runlevel 5).<\/p>\n<p>obs. Use o &#8220;q&#8221; para sair.<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 210px;\">\n<pre>chkconfig foo --list<\/pre>\n<\/td>\n<td style=\"width: 221px;\">ls etc\/systemd\/system\/*.wants\/foo.service<\/td>\n<td style=\"width: 206px;\">Lista todos os servi\u00e7os que existem no systemd para serem gerenciados, no seu nivel de execu\u00e7\u00e3o \u00e9 claro.<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 210px;\">init 3 (texto)<\/p>\n<p>init 5 (gr\u00e1fico)*<\/p>\n<p>somente se aplica a distribui\u00e7\u00f5es baseadas em Red Hat, pois Debian sempre \u00e9 2.<\/td>\n<td style=\"width: 221px;\">systemctl isolate graphical.target<\/p>\n<p>(para alterar para runlevel 5 ou seja, com gr\u00e1fico)<\/p>\n<p>systemctl isolate multi-user.target<\/p>\n<p>(para alterar para a runlevel 3, ou seja, sem gr\u00e1fico)<\/td>\n<td style=\"width: 206px;\">O comando isolate permite alterar a runlevel em tempo real no sistema, como voce fazia antes com o comando init. O comando init ainda funciona? SIM! No Fedora e geralmente em quase todas as distribui\u00e7\u00f5es o comando init \u00e9 um link simb\u00f3lico para\u00a0..\/lib\/systemd\/systemd.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>Para saber mais como gerenciar servi\u00e7os do Systemd atrav\u00e9s do Systemctl, d\u00ea uma olhada neste artigo abaixo:<\/h3>\n<p><a href=\"https:\/\/cleuber.com.br\/index.php\/2016\/06\/17\/como-usar-o-systemctl-para-gerenciar-servicos-do-systemd\" target=\"_blank\"><img data-recalc-dims=\"1\" decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-11104 size-full\" src=\"https:\/\/i0.wp.com\/cleuber.com.br\/wp-content\/uploads\/2016\/06\/systemctl.png?resize=567%2C519&#038;ssl=1\" alt=\"systemctl\" width=\"567\" height=\"519\" srcset=\"https:\/\/i0.wp.com\/cleuber.com.br\/wp-content\/uploads\/2016\/06\/systemctl.png?w=567&amp;ssl=1 567w, https:\/\/i0.wp.com\/cleuber.com.br\/wp-content\/uploads\/2016\/06\/systemctl.png?resize=300%2C275&amp;ssl=1 300w\" sizes=\"auto, (max-width: 567px) 100vw, 567px\" \/><\/a><\/p>\n<h3>Conclus\u00e3o<\/h3>\n<p>Realmente o Systemd h\u00e1 alguns anos veio e veio para ficar se mostrando superior, e qualquer mudan\u00e7a para melhor \u00e9 muito bem vinda. Claro que existem muitas controv\u00e9rsias sobre o assunto, inclusive do pr\u00f3prio Linus Torvalds e muitos outros desenvolvedores famosos.<\/p>\n<p>Mas o que voc\u00ea acha sobre o assunto?<\/p>\n<p>Abra\u00e7os,<\/p>\n<p>Cleuber<\/p>\n<p>fonte: <a href=\"http:\/\/www.tecmint.com\/systemd-replaces-init-in-linux\/\" target=\"_blank\">tecmint<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>O Que \u00e9 o Init? No Linux, o init \u00e9 uma abreviatura para Inicializa\u00e7\u00e3o. O init \u00e9 um processo daemon, que come\u00e7a assim que o computador \u00e9 iniciado e continuar a executar at\u00e9 o desligamento. De\u00a0fato, o init \u00e9 o primeiro processo que come\u00e7a quando um computador \u00e9 iniciado, tornando-se o pai de todos os &hellip;<\/p>\n","protected":false},"author":1,"featured_media":11054,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"nf_dc_page":"","_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[51,488,348],"tags":[603,602],"class_list":["post-11044","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-dicas-e-tutoriais","category-seguranca","category-servidores-linux","tag-init","tag-systemd"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/cleuber.com.br\/index.php\/wp-json\/wp\/v2\/posts\/11044","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cleuber.com.br\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cleuber.com.br\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cleuber.com.br\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cleuber.com.br\/index.php\/wp-json\/wp\/v2\/comments?post=11044"}],"version-history":[{"count":0,"href":"https:\/\/cleuber.com.br\/index.php\/wp-json\/wp\/v2\/posts\/11044\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/cleuber.com.br\/index.php\/wp-json\/wp\/v2\/media\/11054"}],"wp:attachment":[{"href":"https:\/\/cleuber.com.br\/index.php\/wp-json\/wp\/v2\/media?parent=11044"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cleuber.com.br\/index.php\/wp-json\/wp\/v2\/categories?post=11044"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cleuber.com.br\/index.php\/wp-json\/wp\/v2\/tags?post=11044"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}