<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Arquivos systemd - Remontti</title>
	<atom:link href="https://blog.remontti.com.br/tag/systemd/feed" rel="self" type="application/rss+xml" />
	<link>https://blog.remontti.com.br/tag/systemd</link>
	<description>rudimar@remontti</description>
	<lastBuildDate>Thu, 10 May 2018 18:34:15 +0000</lastBuildDate>
	<language>pt-BR</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://blog.remontti.com.br/wp-content/uploads/2024/09/icone-rr-80x80.png</url>
	<title>Arquivos systemd - Remontti</title>
	<link>https://blog.remontti.com.br/tag/systemd</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Como usar o systemd para iniciar seu script/Aplicação no Debian</title>
		<link>https://blog.remontti.com.br/2478</link>
					<comments>https://blog.remontti.com.br/2478#comments</comments>
		
		<dc:creator><![CDATA[Rudimar Remontti]]></dc:creator>
		<pubDate>Thu, 10 May 2018 18:34:15 +0000</pubDate>
				<category><![CDATA[Dicas]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tutoriais]]></category>
		<category><![CDATA[boot]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[systemd]]></category>
		<guid isPermaLink="false">https://blog.remontti.com.br/?p=2478</guid>

					<description><![CDATA[<p>Nas últimas distribuições Debian (9) é instalado por padrão systemd em vez de sysvinit como sistema de inicialização. Este artigo ilustra como usá-lo. Para iniciar um script na inicialização, um arquivo de serviço deve&#46;&#46;&#46;</p>
<p>O post <a href="https://blog.remontti.com.br/2478">Como usar o systemd para iniciar seu script/Aplicação no Debian</a> apareceu primeiro em <a href="https://blog.remontti.com.br">Remontti</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><img fetchpriority="high" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2018/05/Screenshot_20180510_152652-1024x410.png" alt="" width="1024" height="410" class="alignnone size-large wp-image-2495" srcset="https://blog.remontti.com.br/wp-content/uploads/2018/05/Screenshot_20180510_152652-1024x410.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2018/05/Screenshot_20180510_152652-300x120.png 300w, https://blog.remontti.com.br/wp-content/uploads/2018/05/Screenshot_20180510_152652-768x308.png 768w, https://blog.remontti.com.br/wp-content/uploads/2018/05/Screenshot_20180510_152652.png 1683w" sizes="(max-width: 1024px) 100vw, 1024px" /><br />
Nas últimas distribuições Debian (9) é instalado por padrão systemd em vez de sysvinit como sistema de inicialização. Este artigo ilustra como usá-lo.</p>
<p>Para iniciar um script na inicialização, um arquivo de serviço deve ser criado no systemd.</p>
<p>Vou pegar como base o script de firewall que publiquei (<a href="https://blog.remontti.com.br/2435" rel="noopener" target="_blank">Modelo simples e funcional de Firewall com iptables</a>)</p>
<p>Vamos criar um arquivo de serviço para o nosso programa firewall. Crie como root um arquivo chamado rr-firewall.service no diretório /lib/systemd/system.</p>
<pre class="remontti-code"># vim /lib/systemd/system/rr-firewall.service</pre>
<pre class="remontti-code">[Unit]
Description=Firewall

[Service]
Type=simple
RemainAfterExit=yes
ExecStart=/etc/init.d/rr-firewall start
ExecStop=/etc/init.d/rr-firewall stop
ExecReload=/etc/init.d/rr-firewall restart

[Install]
WantedBy=multi-user.target</pre>
<p>Recarregue a nova definição do serviço:</p>
<pre class="remontti-code"># systemctl daemon-reload</pre>
<p>Ative o novo serviço, e verifique se o mesmo foi ativado</p>
<pre class="remontti-code"># systemctl enable rr-firewall
# systemctl list-unit-files | grep rr-firewall</pre>
<p>Reinicie seu servidor e verifique se seu firewall foi carregado na inicialização.</p>
<pre class="remontti-code"># reboot </pre>
<p>Após reboot, verifique se as regras de firewall foram carregadas  </p>
<pre class="remontti-code"># /etc/init.d/rr-firewall status</pre>
<p><a href="https://blog.remontti.com.br/wp-content/uploads/2018/05/Screenshot_20180510_151227.png" data-rel="lightbox-gallery-XvRzngTx" data-rl_title="" data-rl_caption="" title=""><img decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2018/05/Screenshot_20180510_151227-300x135.png" alt="" width="300" height="135" class="alignnone size-medium wp-image-2491" srcset="https://blog.remontti.com.br/wp-content/uploads/2018/05/Screenshot_20180510_151227-300x135.png 300w, https://blog.remontti.com.br/wp-content/uploads/2018/05/Screenshot_20180510_151227-768x345.png 768w, https://blog.remontti.com.br/wp-content/uploads/2018/05/Screenshot_20180510_151227-1024x460.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2018/05/Screenshot_20180510_151227.png 1433w" sizes="(max-width: 300px) 100vw, 300px" /></a><br />
Veja q nosso script de firewall foi carregado!</p>
<p>Você pode utilizar tabén os comandos:</p>
<pre class="remontti-code"># systemctl start rr-firewall
# systemctl stop rr-firewall
# systemctl restart rr-firewall
# systemctl status rr-firewall</pre>
<p><a href="https://blog.remontti.com.br/wp-content/uploads/2018/05/Screenshot_20180510_152042.png" data-rel="lightbox-gallery-XvRzngTx" data-rl_title="" data-rl_caption="" title=""><img decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2018/05/Screenshot_20180510_152042-300x110.png" alt="" width="300" height="110" class="alignnone size-medium wp-image-2493" srcset="https://blog.remontti.com.br/wp-content/uploads/2018/05/Screenshot_20180510_152042-300x110.png 300w, https://blog.remontti.com.br/wp-content/uploads/2018/05/Screenshot_20180510_152042-768x280.png 768w, https://blog.remontti.com.br/wp-content/uploads/2018/05/Screenshot_20180510_152042-1024x374.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2018/05/Screenshot_20180510_152042.png 1457w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<p>Agora é so usar a criatividade <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f609.png" alt="😉" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
<p>Dica de uma boa leitura sobre Systemctl:<br />
<a href="https://www.digitalocean.com/community/tutorials/how-to-use-systemctl-to-manage-systemd-services-and-units" rel="noopener" target="_blank">How To Use Systemctl to Manage Systemd Services and Units</a></p>
<p>O post <a href="https://blog.remontti.com.br/2478">Como usar o systemd para iniciar seu script/Aplicação no Debian</a> apareceu primeiro em <a href="https://blog.remontti.com.br">Remontti</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.remontti.com.br/2478/feed</wfw:commentRss>
			<slash:comments>5</slash:comments>
		
		
			</item>
	</channel>
</rss>
