Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/freebsd-doc
Path: blob/main/documentation/content/pt-br/articles/rc-scripting/_index.po
18096 views
# SOME DESCRIPTIVE TITLE
# Copyright (C) YEAR The FreeBSD Project
# This file is distributed under the same license as the FreeBSD Documentation package.
# Danilo G. Baio <[email protected]>, 2021, 2022.
# Edson Brandi <[email protected]>, 2023.
# "Danilo G. Baio" <[email protected]>, 2023.
msgid ""
msgstr ""
"Project-Id-Version: FreeBSD Documentation VERSION\n"
"POT-Creation-Date: 2022-07-07 23:23-0300\n"
"PO-Revision-Date: 2023-04-30 08:49+0000\n"
"Last-Translator: Edson Brandi <[email protected]>\n"
"Language-Team: Portuguese (Brazil) <https://translate-dev.freebsd.org/"
"projects/documentation/articlesrc-scripting_index/pt_BR/>\n"
"Language: pt_BR\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n > 1;\n"
"X-Generator: Weblate 4.17\n"

#. type: YAML Front Matter: description
#: documentation/content/en/articles/rc-scripting/_index.adoc:1
#, no-wrap
msgid "A guide to writing new rc.d scripts and understanding those already written"
msgstr ""
"Um guia para escrever novos scripts rc.d e entender aqueles que já existem"

#. type: Title =
#: documentation/content/en/articles/rc-scripting/_index.adoc:1
#: documentation/content/en/articles/rc-scripting/_index.adoc:12
#, no-wrap
msgid "Practical rc.d scripting in BSD"
msgstr "Scripting rc.d na prática no BSD"

#. type: Plain text
#: documentation/content/en/articles/rc-scripting/_index.adoc:45
msgid "Abstract"
msgstr "Resumo"

#. type: Plain text
#: documentation/content/en/articles/rc-scripting/_index.adoc:49
msgid ""
"Beginners may find it difficult to relate the facts from the formal "
"documentation on the BSD [.filename]#rc.d# framework with the practical "
"tasks of [.filename]#rc.d# scripting.  In this article, we consider a few "
"typical cases of increasing complexity, show [.filename]#rc.d# features "
"suited for each case, and discuss how they work.  Such an examination should "
"provide reference points for further study of the design and efficient "
"application of [.filename]#rc.d#."
msgstr ""
"Os iniciantes podem achar difícil relacionar os fatos da documentação formal "
"sobre o framework [.filename]#rc.d# do BSD com as tarefas práticas de "
"escrever scripts [.filename]#rc.d#. Neste artigo, consideramos alguns casos "
"típicos de crescente complexidade, mostramos recursos do [.filename]#rc.d# "
"adequados para cada caso e discutimos como eles funcionam. Essa análise deve "
"fornecer pontos de referência para estudos posteriores do design e aplicação "
"eficiente do [.filename]#rc.d#."

#. type: Plain text
#: documentation/content/en/articles/rc-scripting/_index.adoc:51
msgid "'''"
msgstr "'''"

#. type: Title ==
#: documentation/content/en/articles/rc-scripting/_index.adoc:55
#, no-wrap
msgid "Introduction"
msgstr "Introdução"

#. type: Plain text
#: documentation/content/en/articles/rc-scripting/_index.adoc:61
msgid ""
"The historical BSD had a monolithic startup script, [.filename]#/etc/rc#.  "
"It was invoked by man:init[8] at system boot time and performed all userland "
"tasks required for multi-user operation: checking and mounting file systems, "
"setting up the network, starting daemons, and so on.  The precise list of "
"tasks was not the same in every system; admins needed to customize it.  With "
"few exceptions, [.filename]#/etc/rc# had to be modified, and true hackers "
"liked it."
msgstr ""
"No histórico BSD, havia um script de inicialização monolítico, [.filename]#/"
"etc/rc#. Ele era invocado pelo man:init[8] no momento da inicialização do "
"sistema e realizava todas as tarefas de usuário necessárias para a operação "
"multiusuário: verificação e montagem de sistemas de arquivos, configuração "
"da rede, inicialização de daemons e assim por diante. A lista precisa de "
"tarefas não era a mesma em todos os sistemas; os administradores precisavam "
"personalizá-la. Com poucas exceções, o [.filename]#/etc/rc# tinha que ser "
"modificado, e os verdadeiros hackers gostavam disso."

#. type: Plain text
#: documentation/content/en/articles/rc-scripting/_index.adoc:67
msgid ""
"The real problem with the monolithic approach was that it provided no "
"control over the individual components started from [.filename]#/etc/rc#.  "
"For instance, [.filename]#/etc/rc# could not restart a single daemon.  The "
"system admin had to find the daemon process by hand, kill it, wait until it "
"actually exited, then browse through [.filename]#/etc/rc# for the flags, and "
"finally type the full command line to start the daemon again.  The task "
"would become even more difficult and prone to errors if the service to "
"restart consisted of more than one daemon or demanded additional actions.  "
"In a few words, the single script failed to fulfil what scripts are for: to "
"make the system admin's life easier."
msgstr ""
"O problema real com a abordagem monolítica era que ela não fornecia controle "
"sobre os componentes individuais iniciados a partir do [.filename]#/etc/rc#. "
"Por exemplo, o [.filename]#/etc/rc# não podia reiniciar um único daemon. O "
"administrador do sistema tinha que encontrar o processo do daemon "
"manualmente, matá-lo, aguardar até que ele realmente finalizasse, navegar "
"por [.filename]#/etc/rc# em busca das flags e, finalmente, digitar a linha "
"de comando completa para iniciar o daemon novamente. A tarefa se tornaria "
"ainda mais difícil e propensa a erros se o serviço a ser reiniciado "
"consistisse em mais de um daemon ou exigisse ações adicionais. Em poucas "
"palavras, o script único falhou em cumprir o objetivo pelo qual um script é "
"criado: tornar a vida do administrador do sistema mais fácil."

#. type: Plain text
#: documentation/content/en/articles/rc-scripting/_index.adoc:74
msgid ""
"Later there was an attempt to split out some parts of [.filename]#/etc/rc# "
"for the sake of starting the most important subsystems separately.  The "
"notorious example was [.filename]#/etc/netstart# to bring up networking.  It "
"did allow for accessing the network from single-user mode, but it did not "
"integrate well into the automatic startup process because parts of its code "
"needed to interleave with actions essentially unrelated to networking.  That "
"was why [.filename]#/etc/netstart# mutated into [.filename]#/etc/rc."
"network#.  The latter was no longer an ordinary script; it comprised of "
"large, tangled man:sh[1] functions called from [.filename]#/etc/rc# at "
"different stages of system startup.  However, as the startup tasks grew "
"diverse and sophisticated, the \"quasi-modular\" approach became even more "
"of a drag than the monolithic [.filename]#/etc/rc# had been."
msgstr ""
"Mais tarde, houve uma tentativa de dividir algumas partes do [.filename]#/"
"etc/rc# para iniciar os subsistemas mais importantes separadamente. O "
"exemplo notório foi o [.filename]#/etc/netstart# para iniciar a rede. Isso "
"permitiu o acesso à rede no modo de usuário único, mas não se integrou bem "
"ao processo de inicialização automática porque partes de seu código "
"precisavam intercalar com ações essencialmente não relacionadas à rede. Foi "
"por isso que o [.filename]#/etc/netstart# se transformou em [.filename]#/etc/"
"rc.network#. Este último não era mais um script comum; era composto de "
"grandes funções man:sh[1] complexas chamadas pelo [.filename]#/etc/rc# em "
"diferentes estágios da inicialização do sistema. No entanto, à medida que as "
"tarefas de inicialização ficaram mais diversas e sofisticadas, a abordagem "
"\"quase modular\" tornou-se ainda mais pesada do que o monolítico [."
"filename]#/etc/rc# tinha sido."

#. type: Plain text
#: documentation/content/en/articles/rc-scripting/_index.adoc:82
msgid ""
"Without a clean and well-designed framework, the startup scripts had to bend "
"over backwards to satisfy the needs of rapidly developing BSD-based "
"operating systems.  It became obvious at last that more steps are necessary "
"on the way to a fine-grained and extensible [.filename]#rc# system.  Thus "
"BSD [.filename]#rc.d# was born.  Its acknowledged fathers were Luke Mewburn "
"and the NetBSD community.  Later it was imported into FreeBSD.  Its name "
"refers to the location of system scripts for individual services, which is "
"in [.filename]#/etc/rc.d#.  Soon we will learn about more components of the "
"[.filename]#rc.d# system and see how the individual scripts are invoked."
msgstr ""
"Sem um framework limpo e bem projetado, os scripts de inicialização tiveram "
"que se dobrar para atender às necessidades dos sistemas operacionais "
"baseados em BSD que estavam em rápida evolução. Tornou-se evidente, "
"finalmente, que mais etapas eram necessárias para se chegar a um sistema [."
"filename]#rc# refinado, granular e extensível. Assim nasceu o [.filename]#rc."
"d# do BSD. Seus pais reconhecidos foram Luke Mewburn e a comunidade NetBSD. "
"Mais tarde, foi importado para o FreeBSD. Seu nome se refere ao local dos "
"scripts do sistema para serviços individuais, que está em [.filename]#/etc/rc"
".d#. Em breve, aprenderemos mais sobre os componentes do sistema [."
"filename]#rc.d# e veremos como os scripts individuais são invocados."

#. type: Plain text
#: documentation/content/en/articles/rc-scripting/_index.adoc:93
msgid ""
"The basic ideas behind BSD [.filename]#rc.d# are _fine modularity_ and "
"__code reuse__.  _Fine modularity_ means that each basic \"service\" such as "
"a system daemon or primitive startup task gets its own man:sh[1] script able "
"to start the service, stop it, reload it, check its status.  A particular "
"action is chosen by the command-line argument to the script.  The [."
"filename]#/etc/rc# script still drives system startup, but now it merely "
"invokes the smaller scripts one by one with the `start` argument.  It is "
"easy to perform shutdown tasks as well by running the same set of scripts "
"with the `stop` argument, which is done by [.filename]#/etc/rc.shutdown#.  "
"Note how closely this follows the Unix way of having a set of small "
"specialized tools, each fulfilling its task as well as possible.  _Code "
"reuse_ means that common operations are implemented as man:sh[1] functions "
"and collected in [.filename]#/etc/rc.subr#.  Now a typical script can be "
"just a few lines' worth of man:sh[1] code.  Finally, an important part of "
"the [.filename]#rc.d# framework is man:rcorder[8], which helps [.filename]#/"
"etc/rc# to run the small scripts orderly with respect to dependencies "
"between them.  It can help [.filename]#/etc/rc.shutdown#, too, because the "
"proper order for the shutdown sequence is opposite to that of startup."
msgstr ""
"As ideias básicas por trás do [.filename]#rc.d# do BSD são _modularidade "
"fina_ e __reutilização de código__. _Modularidade fina_ significa que cada "
"\"serviço\" básico, como um daemon do sistema ou uma tarefa de inicialização "
"primitiva, possui seu próprio script man:sh[1] capaz de iniciar o serviço, "
"pará-lo, recarregá-lo e verificar seu status. Uma ação específica é "
"escolhida pelo argumento da linha de comando do script. O script [."
"filename]#/etc/rc# ainda conduz a inicialização do sistema, mas agora ele "
"apenas invoca os scripts menores um por um com o argumento `start`. Também é "
"fácil realizar tarefas de desligamento executando o mesmo conjunto de "
"scripts com o argumento `stop`, que é feito por [.filename]#/etc/rc.shutdown#"
". Observe como isso segue de perto a maneira Unix de ter um conjunto de "
"ferramentas especializadas pequenas, cada uma cumprindo sua tarefa da melhor "
"maneira possível. _Reutilização de código_ significa que operações comuns "
"são implementadas como funções man:sh[1] e coletadas em [.filename]#/etc/rc."
"subr#. Agora, um script típico pode ser composto apenas de algumas linhas de "
"código man:sh[1]. Finalmente, uma parte importante do framework [."
"filename]#rc.d# é o man:rcorder[8], que ajuda o [.filename]#/etc/rc# a "
"executar os pequenos scripts de maneira ordenada com respeito às "
"dependências entre eles. Isso também pode ajudar o [.filename]#/etc/rc."
"shutdown#, porque a ordem apropriada para a sequência de desligamento é "
"oposta à de inicialização."

#. type: Plain text
#: documentation/content/en/articles/rc-scripting/_index.adoc:101
msgid ""
"The BSD [.filename]#rc.d# design is described in <<lukem, the original "
"article by Luke Mewburn>>, and the [.filename]#rc.d# components are "
"documented in great detail in <<manpages, the respective manual pages>>.  "
"However, it might not appear obvious to an [.filename]#rc.d# newbie how to "
"tie the numerous bits and pieces together in order to create a well-styled "
"script for a particular task.  Therefore this article will try a different "
"approach to describe [.filename]#rc.d#.  It will show which features should "
"be used in a number of typical cases, and why.  Note that this is not a how-"
"to document because our aim is not at giving ready-made recipes, but at "
"showing a few easy entrances into the [.filename]#rc.d# realm.  Neither is "
"this article a replacement for the relevant manual pages.  Do not hesitate "
"to refer to them for more formal and complete documentation while reading "
"this article."
msgstr ""
"O design do BSD [.filename]#rc.d# é descrito no <<lukem, artigo original de "
"Luke Mewburn>>, e os componentes do [.filename]#rc.d# são documentados em "
"grande detalhe nas <<manpages, respectivas páginas do manual>>. No entanto, "
"pode não ser óbvio para um iniciante no [.filename]#rc.d# como ele deve unir "
"as numerosas partes para criar um script bem estruturado para uma tarefa "
"específica. Portanto, este artigo tentará abordar o [.filename]#rc.d# de "
"forma diferente. Mostrará quais recursos devem ser usados em vários casos "
"típicos e por que. Observe que este não é um documento de \"como fazer\", "
"porque nosso objetivo não é fornecer receitas prontas, mas mostrar algumas "
"entradas fáceis no mundo do [.filename]#rc.d#. Este artigo também não "
"substitui as páginas do manual relevantes. Não hesite em consultá-las para "
"obter documentação mais formal e completa enquanto lê este artigo."

#. type: Plain text
#: documentation/content/en/articles/rc-scripting/_index.adoc:105
msgid ""
"There are prerequisites to understanding this article.  First of all, you "
"should be familiar with the man:sh[1] scripting language in order to master "
"[.filename]#rc.d#.  In addition, you should know how the system performs "
"userland startup and shutdown tasks, which is described in man:rc[8]."
msgstr ""
"Existem pré-requisitos para entender este artigo. Em primeiro lugar, você "
"deve estar familiarizado com a linguagem de script man:sh[1] para dominar o ["
".filename]#rc.d#. Além disso, você deve saber como o sistema realiza tarefas "
"de inicialização e desligamento do espaço do usuário, o que é descrito em "
"man:rc[8]."

#. type: Plain text
#: documentation/content/en/articles/rc-scripting/_index.adoc:108
msgid ""
"This article focuses on the FreeBSD branch of [.filename]#rc.d#.  "
"Nevertheless, it may be useful to NetBSD developers, too, because the two "
"branches of BSD [.filename]#rc.d# not only share the same design but also "
"stay similar in their aspects visible to script authors."
msgstr ""
"Este artigo foca no ramo do FreeBSD do [.filename]#rc.d#. No entanto, ele "
"pode ser útil também para desenvolvedores do NetBSD, pois os dois ramos do [."
"filename]#rc.d# não apenas compartilham o mesmo design, mas também "
"permanecem similares em seus aspectos visíveis aos autores de scripts."

#. type: Title ==
#: documentation/content/en/articles/rc-scripting/_index.adoc:110
#, no-wrap
msgid "Outlining the task"
msgstr "Esboçando a tarefa"

#. type: Plain text
#: documentation/content/en/articles/rc-scripting/_index.adoc:114
msgid ""
"A little consideration before starting `$EDITOR` will not hurt.  In order to "
"write a well-tempered [.filename]#rc.d# script for a system service, we "
"should be able to answer the following questions first:"
msgstr ""
"Uma pequena reflexão antes de iniciar o `$EDITOR` não fará mal. Para "
"escrever um script [.filename]#rc.d# bem elaborado para um serviço do "
"sistema, devemos ser capazes de responder às seguintes perguntas primeiro:"

#. type: Plain text
#: documentation/content/en/articles/rc-scripting/_index.adoc:116
msgid "Is the service mandatory or optional?"
msgstr "O serviço é obrigatório ou opcional?"

#. type: Plain text
#: documentation/content/en/articles/rc-scripting/_index.adoc:117
msgid ""
"Will the script serve a single program, e.g., a daemon, or perform more "
"complex actions?"
msgstr ""
"O script servirá um único programa, por exemplo, um daemon, ou realizará "
"ações mais complexas?"

#. type: Plain text
#: documentation/content/en/articles/rc-scripting/_index.adoc:118
msgid "Which other services will our service depend on, and vice versa?"
msgstr "De quais outros serviços nosso serviço dependerá e vice-versa?"

#. type: Plain text
#: documentation/content/en/articles/rc-scripting/_index.adoc:120
msgid ""
"From the examples that follow we will see why it is important to know the "
"answers to these questions."
msgstr ""
"A partir dos exemplos que se seguem, veremos o porque é importante conhecer "
"as respostas a essas perguntas."

#. type: Title ==
#: documentation/content/en/articles/rc-scripting/_index.adoc:122
#, no-wrap
msgid "A dummy script"
msgstr "Um script fictício"

#. type: Plain text
#: documentation/content/en/articles/rc-scripting/_index.adoc:125
msgid ""
"The following script just emits a message each time the system boots up:"
msgstr ""
"O script a seguir apenas emite uma mensagem toda vez que o sistema é "
"inicializado:"

#. type: delimited block . 4
#: documentation/content/en/articles/rc-scripting/_index.adoc:129
#, no-wrap
msgid "#!/bin/sh <.>\n"
msgstr "#!/bin/sh <.>\n"

#. type: delimited block . 4
#: documentation/content/en/articles/rc-scripting/_index.adoc:131
#, no-wrap
msgid ". /etc/rc.subr <.>\n"
msgstr ". /etc/rc.subr <.>\n"

#. type: delimited block . 4
#: documentation/content/en/articles/rc-scripting/_index.adoc:135
#, no-wrap
msgid ""
"name=\"dummy\" <.>\n"
"start_cmd=\"${name}_start\" <.>\n"
"stop_cmd=\":\" <.>\n"
msgstr ""
"name=\"dummy\" <.>\n"
"start_cmd=\"${name}_start\" <.>\n"
"stop_cmd=\":\" <.>\n"

#. type: delimited block . 4
#: documentation/content/en/articles/rc-scripting/_index.adoc:140
#, no-wrap
msgid ""
"dummy_start() <.>\n"
"{\n"
"\techo \"Nothing started.\"\n"
"}\n"
msgstr ""
"dummy_start() <.>\n"
"{\n"
"\techo \"Nothing started.\"\n"
"}\n"

#. type: delimited block . 4
#: documentation/content/en/articles/rc-scripting/_index.adoc:143
#, no-wrap
msgid ""
"load_rc_config $name <.>\n"
"run_rc_command \"$1\" <.>\n"
msgstr ""
"load_rc_config $name <.>\n"
"run_rc_command \"$1\" <.>\n"

#. type: Plain text
#: documentation/content/en/articles/rc-scripting/_index.adoc:146
msgid "Things to note are:"
msgstr "Os pontos a serem observados são:"

#. type: Plain text
#: documentation/content/en/articles/rc-scripting/_index.adoc:152
msgid ""
"&#10122; An interpreted script should begin with the magic \"shebang\" "
"line.  That line specifies the interpreter program for the script.  Due to "
"the shebang line, the script can be invoked exactly like a binary program "
"provided that it has the execute bit set.  (See man:chmod[1].)  For example, "
"a system admin can run our script manually, from the command line:"
msgstr ""
"&#10122; Um script interpretado deve começar com a linha mágica \"shebang\". "
"Essa linha especifica o programa interpretador para o script. Devido à linha "
"shebang, o script pode ser invocado exatamente como um programa binário, "
"desde que tenha o bit de execução definido. (Veja man:chmod[1].) Por "
"exemplo, um administrador do sistema pode executar nosso script manualmente, "
"a partir da linha de comando:"

#. type: delimited block . 4
#: documentation/content/en/articles/rc-scripting/_index.adoc:156
#, no-wrap
msgid "# /etc/rc.d/dummy start\n"
msgstr "# /etc/rc.d/dummy start\n"

#. type: delimited block = 4
#: documentation/content/en/articles/rc-scripting/_index.adoc:162
msgid ""
"In order to be properly managed by the [.filename]#rc.d# framework, its "
"scripts need to be written in the man:sh[1] language.  If you have a service "
"or port that uses a binary control utility or a startup routine written in "
"another language, install that element in [.filename]#/usr/sbin# (for the "
"system) or [.filename]#/usr/local/sbin# (for ports) and call it from a man:"
"sh[1] script in the appropriate [.filename]#rc.d# directory."
msgstr ""
"Para ser gerenciado corretamente pelo framework [.filename]#rc.d#, os "
"scripts devem ser escritos na linguagem man:sh[1]. Se você tiver um serviço "
"ou port que usa um utilitário de controle binário ou uma rotina de "
"inicialização escrita em outra linguagem, instale esse elemento em [."
"filename]#/usr/sbin# (para o sistema) ou [.filename]#/usr/local/sbin# (para "
"ports) e chame-o a partir de um script man:sh[1] no diretório [.filename]#rc."
"d# apropriado."

#. type: delimited block = 4
#: documentation/content/en/articles/rc-scripting/_index.adoc:167
msgid ""
"If you would like to learn the details of why [.filename]#rc.d# scripts must "
"be written in the man:sh[1] language, see how [.filename]#/etc/rc# invokes "
"them by means of `run_rc_script`, then study the implementation of "
"`run_rc_script` in [.filename]#/etc/rc.subr#."
msgstr ""
"Se você gostaria de aprender os detalhes de por que os scripts [.filename]#rc"
".d# devem ser escritos na linguagem man:sh[1], veja como o [.filename]#/etc/"
"rc# os invoca por meio de `run_rc_script` e, em seguida, estude a "
"implementação de `run_rc_script` em [.filename]#/etc/rc.subr#."

#. type: Plain text
#: documentation/content/en/articles/rc-scripting/_index.adoc:173
msgid ""
"&#10123; In [.filename]#/etc/rc.subr#, a number of man:sh[1] functions are "
"defined for an [.filename]#rc.d# script to use.  The functions are "
"documented in man:rc.subr[8].  While it is theoretically possible to write "
"an [.filename]#rc.d# script without ever using man:rc.subr[8], its functions "
"prove extremely handy and make the job an order of magnitude easier. So it "
"is no surprise that everybody resorts to man:rc.subr[8] in [.filename]#rc.d# "
"scripts.  We are not going to be an exception."
msgstr ""
"&#10123; Em [.filename]#/etc/rc.subr#, uma série de funções man:sh[1] estão "
"definidas para serem utilizadas por um script [.filename]#rc.d#. As funções "
"estão documentadas em man:rc.subr[8]. Embora seja teoricamente possível "
"escrever um script [.filename]#rc.d# sem nunca usar o man:rc.subr[8], suas "
"funções provam ser extremamente úteis e tornam o trabalho uma ordem de "
"magnitude mais fácil. Portanto, não é surpresa que todo mundo recorra ao "
"man:rc.subr[8] em scripts [.filename]#rc.d#. Não seremos uma exceção."

#. type: Plain text
#: documentation/content/en/articles/rc-scripting/_index.adoc:176
msgid ""
"An [.filename]#rc.d# script must \"source\"[.filename]#/etc/rc.subr# "
"(include it using \"`.`\") _before_ it calls man:rc.subr[8] functions so "
"that man:sh[1] has an opportunity to learn the functions.  The preferred "
"style is to source [.filename]#/etc/rc.subr# first of all."
msgstr ""
"Um script [.filename]#rc.d# deve fazer o \"source\" do [.filename]#/etc/rc."
"subr# (inclua-o usando \"`.`\") _antes_ de chamar as funções man:rc.subr[8] "
"para que o man:sh[1] tenha a oportunidade de aprender as funções. O estilo "
"preferido é incluir o [.filename]#/etc/rc.subr# antes de tudo."

#. type: delimited block = 4
#: documentation/content/en/articles/rc-scripting/_index.adoc:180
msgid ""
"Some useful functions related to networking are provided by another include "
"file, [.filename]#/etc/network.subr#."
msgstr ""
"Algumas funções úteis relacionadas à rede são fornecidas por outro arquivo "
"de inclusão, o [.filename]#/etc/network.subr#."

#. type: Plain text
#: documentation/content/en/articles/rc-scripting/_index.adoc:185
msgid ""
"&#10124; [[name-var]]The mandatory variable `name` specifies the name of our "
"script.  It is required by man:rc.subr[8].  That is, each [.filename]#rc.d# "
"script _must_ set `name` before it calls man:rc.subr[8] functions."
msgstr ""
"&#10124; A variável obrigatória `name` especifica o nome do nosso script. "
"Ela é exigida pelo man:rc.subr[8]. Isso significa que cada script [."
"filename]#rc.d# _deve_ definir `name` antes de chamar funções do man:rc."
"subr[8]."

#. type: Plain text
#: documentation/content/en/articles/rc-scripting/_index.adoc:189
msgid ""
"Now it is the right time to choose a unique name for our script once and for "
"all.  We will use it in a number of places while developing the script.  For "
"a start, let us give the same name to the script file, too."
msgstr ""
"Agora é o momento certo para escolher um nome exclusivo para o nosso script "
"de uma vez por todas. Vamos usá-lo em vários lugares enquanto desenvolvemos "
"o script. Para começar, também vamos dar o mesmo nome ao arquivo de script."

#. type: delimited block = 4
#: documentation/content/en/articles/rc-scripting/_index.adoc:196
msgid ""
"The current style of [.filename]#rc.d# scripting is to enclose values "
"assigned to variables in double quotes.  Keep in mind that it is just a "
"style issue that may not always be applicable.  You can safely omit quotes "
"from around simple words without man:sh[1] metacharacters in them, while in "
"certain cases you will need single quotes to prevent any interpretation of "
"the value by man:sh[1].  A programmer should be able to tell the language "
"syntax from style conventions and use both of them wisely."
msgstr ""
"O estilo atual de escrita de scripts [.filename]#rc.d# é envolver os valores "
"atribuídos às variáveis em aspas duplas. Tenha em mente que isso é apenas "
"uma questão de estilo que nem sempre é aplicável. Você pode seguramente "
"omitir as aspas ao redor de palavras simples sem metacaracteres man:sh[1], "
"enquanto em certos casos você precisará de aspas simples para evitar "
"qualquer interpretação do valor por man:sh[1]. Um programador deve ser capaz "
"de distinguir a sintaxe da linguagem das convenções de estilo e usá-las "
"sabiamente."

#. type: Plain text
#: documentation/content/en/articles/rc-scripting/_index.adoc:202
msgid ""
"&#10125; The main idea behind man:rc.subr[8] is that an [.filename]#rc.d# "
"script provides handlers, or methods, for man:rc.subr[8] to invoke.  In "
"particular, `start`, `stop`, and other arguments to an [.filename]#rc.d# "
"script are handled this way.  A method is a man:sh[1] expression stored in a "
"variable named `argument_cmd`, where _argument_ corresponds to what can be "
"specified on the script's command line.  We will see later how man:rc."
"subr[8] provides default methods for the standard arguments."
msgstr ""
"&#10125; Cada script [.filename]#rc.d# fornece manipuladores, ou métodos, "
"para o man:rc.subr[8] invocar. Em particular, `start`, `stop`, e outros "
"argumentos para um script [.filename]#rc.d# são manipulados desta forma. Um "
"método é uma expressão man:sh[1] armazenada em uma variável chamada "
"`argument_cmd`, onde _argument_ corresponde ao que pode ser especificado na "
"linha de comando do script. Veremos mais tarde como o man:rc.subr[8] fornece "
"métodos padrão para os argumentos padrão."

#. type: delimited block = 4
#: documentation/content/en/articles/rc-scripting/_index.adoc:207
msgid ""
"To make the code in [.filename]#rc.d# more uniform, it is common to use `"
"${name}` wherever appropriate.  Thus a number of lines can be just copied "
"from one script to another."
msgstr ""
"Para tornar o código em [.filename]#rc.d# mais uniforme, é comum usar "
"`${name}` sempre que apropriado. Assim, várias linhas podem ser simplesmente "
"copiadas de um script para outro."

#. type: Plain text
#: documentation/content/en/articles/rc-scripting/_index.adoc:211
msgid ""
"&#10126; We should keep in mind that man:rc.subr[8] provides default methods "
"for the standard arguments.  Consequently, we must override a standard "
"method with a no-op man:sh[1] expression if we want it to do nothing."
msgstr ""
"&#10126; Devemos ter em mente que o man:rc.subr[8] fornece métodos padrões "
"para os argumentos padrões. Consequentemente, devemos substituir um método "
"padrão por uma expressão man:sh[1] sem efeito se quisermos que ele não faça "
"nada."

#. type: Plain text
#: documentation/content/en/articles/rc-scripting/_index.adoc:214
msgid ""
"&#10127; The body of a sophisticated method can be implemented as a "
"function.  It is a good idea to make the function name meaningful."
msgstr ""
"&#10127; O corpo de um método sofisticado pode ser implementado como uma "
"função. É uma boa ideia dar um nome significativo à função."

#. type: delimited block = 4
#: documentation/content/en/articles/rc-scripting/_index.adoc:218
msgid ""
"It is strongly recommended to add the prefix `${name}` to the names of all "
"functions defined in our script so they never clash with the functions from "
"man:rc.subr[8] or another common include file."
msgstr ""
"Recomenda-se fortemente adicionar o prefixo `${name}` aos nomes de todas as "
"funções definidas no nosso script para que nunca entrem em conflito com as "
"funções de man:rc.subr[8] ou outro arquivo de inclusão comum."

#. type: Plain text
#: documentation/content/en/articles/rc-scripting/_index.adoc:222
msgid ""
"&#10128; This call to man:rc.subr[8] loads man:rc.conf[5] variables.  Our "
"script makes no use of them yet, but it still is recommended to load man:rc."
"conf[5] because there can be man:rc.conf[5] variables controlling man:rc."
"subr[8] itself."
msgstr ""
"&#10128; Essa chamada para o man:rc.subr[8] carrega as variáveis do man:rc."
"conf[5]. Nosso script ainda não as usa, mas ainda é recomendável carregar o "
"man:rc.conf[5] porque pode haver variáveis do man:rc.conf[5] controlando o "
"man:rc.subr[8] em si."

#. type: Plain text
#: documentation/content/en/articles/rc-scripting/_index.adoc:225
msgid ""
"&#10129; Usually this is the last command in an [.filename]#rc.d# script.  "
"It invokes the man:rc.subr[8] machinery to perform the requested action "
"using the variables and methods our script has provided."
msgstr ""
"&#10129; Geralmente, esse é o último comando em um script [.filename]#rc.d#. "
"Ele invoca a maquinaria do man:rc.subr[8] para realizar a ação solicitada "
"usando as variáveis e métodos que o nosso script forneceu."

#. type: Title ==
#: documentation/content/en/articles/rc-scripting/_index.adoc:227
#, no-wrap
msgid "A configurable dummy script"
msgstr "Um script fictício configurável"

#. type: Plain text
#: documentation/content/en/articles/rc-scripting/_index.adoc:237
msgid ""
"Now let us add some controls to our dummy script.  As you may know, [."
"filename]#rc.d# scripts are controlled with man:rc.conf[5].  Fortunately, "
"man:rc.subr[8] hides all the complications from us.  The following script "
"uses man:rc.conf[5] via man:rc.subr[8] to see whether it is enabled in the "
"first place, and to fetch a message to show at boot time.  These two tasks "
"in fact are independent.  On the one hand, an [.filename]#rc.d# script can "
"just support enabling and disabling its service.  On the other hand, a "
"mandatory [.filename]#rc.d# script can have configuration variables.  We "
"will do both things in the same script though:"
msgstr ""
"Agora vamos adicionar alguns controles ao nosso script fictício. Como você "
"deve saber, scripts [.filename]#rc.d# são controlados com o man:rc.conf[5]. "
"Felizmente, o man:rc.subr[8] oculta todas as complicações para nós. O script "
"a seguir usa o man:rc.conf[5] por meio do man:rc.subr[8] para verificar se "
"está habilitado em primeiro lugar e para buscar uma mensagem para ser "
"exibida na inicialização. Essas duas tarefas, na verdade, são independentes. "
"Por um lado, um script [.filename]#rc.d# pode apenas suportar a habilitação "
"e desabilitação do seu serviço. Por outro lado, um script [.filename]#rc.d# "
"obrigatório pode ter variáveis de configuração. No entanto, faremos as duas "
"coisas no mesmo script:"

#. type: delimited block . 4
#: documentation/content/en/articles/rc-scripting/_index.adoc:241
#: documentation/content/en/articles/rc-scripting/_index.adoc:332
#: documentation/content/en/articles/rc-scripting/_index.adoc:389
#: documentation/content/en/articles/rc-scripting/_index.adoc:621
#: documentation/content/en/articles/rc-scripting/_index.adoc:752
#, no-wrap
msgid "#!/bin/sh\n"
msgstr "#!/bin/sh\n"

#. type: delimited block . 4
#: documentation/content/en/articles/rc-scripting/_index.adoc:243
#: documentation/content/en/articles/rc-scripting/_index.adoc:334
#: documentation/content/en/articles/rc-scripting/_index.adoc:391
#: documentation/content/en/articles/rc-scripting/_index.adoc:628
#: documentation/content/en/articles/rc-scripting/_index.adoc:754
#, no-wrap
msgid ". /etc/rc.subr\n"
msgstr ". /etc/rc.subr\n"

#. type: delimited block . 4
#: documentation/content/en/articles/rc-scripting/_index.adoc:246
#, no-wrap
msgid ""
"name=dummy\n"
"rcvar=dummy_enable <.>\n"
msgstr ""
"name=dummy\n"
"rcvar=dummy_enable <.>\n"

#. type: delimited block . 4
#: documentation/content/en/articles/rc-scripting/_index.adoc:249
#, no-wrap
msgid ""
"start_cmd=\"${name}_start\"\n"
"stop_cmd=\":\"\n"
msgstr ""
"start_cmd=\"${name}_start\"\n"
"stop_cmd=\":\"\n"

#. type: delimited block . 4
#: documentation/content/en/articles/rc-scripting/_index.adoc:253
#, no-wrap
msgid ""
"load_rc_config $name <.>\n"
": ${dummy_enable:=no} <.>\n"
": ${dummy_msg=\"Nothing started.\"} <.>\n"
msgstr ""
"load_rc_config $name <.>\n"
": ${dummy_enable:=no} <.>\n"
": ${dummy_msg=\"Nothing started.\"} <.>\n"

#. type: delimited block . 4
#: documentation/content/en/articles/rc-scripting/_index.adoc:258
#, no-wrap
msgid ""
"dummy_start()\n"
"{\n"
"\techo \"$dummy_msg\" <.>\n"
"}\n"
msgstr ""
"dummy_start()\n"
"{\n"
"\techo \"$dummy_msg\" <.>\n"
"}\n"

#. type: delimited block . 4
#: documentation/content/en/articles/rc-scripting/_index.adoc:260
#, no-wrap
msgid "run_rc_command \"$1\"\n"
msgstr "run_rc_command \"$1\"\n"

#. type: Plain text
#: documentation/content/en/articles/rc-scripting/_index.adoc:263
msgid "What changed in this example?"
msgstr "O que mudou neste exemplo?"

#. type: Plain text
#: documentation/content/en/articles/rc-scripting/_index.adoc:265
msgid ""
"&#10122; The variable `rcvar` specifies the name of the ON/OFF knob variable."
msgstr ""
"&#10122; A variável `rcvar` especifica o nome da variável do botão LIGA/"
"DESLIGA."

#. type: Plain text
#: documentation/content/en/articles/rc-scripting/_index.adoc:267
msgid ""
"&#10123; Now `load_rc_config` is invoked earlier in the script, before any "
"man:rc.conf[5] variables are accessed."
msgstr ""
"&#10123; Agora, o `load_rc_config` é invocado mais cedo no script, antes que "
"quaisquer variáveis do man:rc.conf[5] sejam acessadas."

#. type: delimited block = 4
#: documentation/content/en/articles/rc-scripting/_index.adoc:273
msgid ""
"While examining [.filename]#rc.d# scripts, keep in mind that man:sh[1] "
"defers the evaluation of expressions in a function until the latter is "
"called.  Therefore it is not an error to invoke `load_rc_config` as late as "
"just before `run_rc_command` and still access man:rc.conf[5] variables from "
"the method functions exported to `run_rc_command`.  This is because the "
"method functions are to be called by `run_rc_command`, which is invoked "
"_after_ `load_rc_config`."
msgstr ""
"Enquanto examina os scripts [.filename]#rc.d#, tenha em mente que o man:sh[1]"
" adia a avaliação de expressões em uma função até que esta seja chamada. "
"Portanto, não é um erro invocar `load_rc_config` tão tarde quanto logo antes "
"de `run_rc_command` e ainda assim acessar as variáveis man:rc.conf[5] das "
"funções de método exportadas para `run_rc_command`. Isso ocorre porque as "
"funções de método devem ser chamadas por `run_rc_command`, que é invocado "
"_após_ `load_rc_config`."

#. type: Plain text
#: documentation/content/en/articles/rc-scripting/_index.adoc:279
msgid ""
"&#10124; A warning will be emitted by `run_rc_command` if `rcvar` itself is "
"set, but the indicated knob variable is unset.  If your [.filename]#rc.d# "
"script is for the base system, you should add a default setting for the knob "
"to [.filename]#/etc/defaults/rc.conf# and document it in man:rc.conf[5].  "
"Otherwise it is your script that should provide a default setting for the "
"knob.  The canonical approach to the latter case is shown in the example."
msgstr ""
"&#10124; Aviso será emitido pelo `run_rc_command` se o `rcvar` em si estiver "
"configurado, mas a variável de controle indicada estiver desativada. Se o "
"seu script [.filename]#rc.d# é para o sistema base, você deve adicionar uma "
"configuração padrão para o knob em [.filename]#/etc/defaults/rc.conf# e "
"documentá-lo em man:rc.conf[5]. Caso contrário, é seu script que deve "
"fornecer uma configuração padrão para o knob. A abordagem canônica para o "
"último caso é mostrada no exemplo."

#. type: delimited block = 4
#: documentation/content/en/articles/rc-scripting/_index.adoc:286
msgid ""
"You can make man:rc.subr[8] act as though the knob is set to `ON`, "
"irrespective of its current setting, by prefixing the argument to the script "
"with `one` or `force`, as in `onestart` or `forcestop`.  Keep in mind though "
"that `force` has other dangerous effects we will touch upon below, while "
"`one` just overrides the ON/OFF knob.  E.g., assume that `dummy_enable` is "
"`OFF`.  The following command will run the `start` method in spite of the "
"setting:"
msgstr ""
"Você pode fazer o man:rc.subr[8] agir como se o botão estivesse definido "
"como `ON`, independentemente de sua configuração atual, prefixando o "
"argumento do script com `one` ou `force`, como em `onestart` ou `forcestop`. "
"No entanto, tenha em mente que `force` tem outros efeitos perigosos que "
"abordaremos abaixo, enquanto `one` apenas substitui o botão ON/OFF. Por "
"exemplo, suponha que `dummy_enable` esteja definido como `OFF`. O seguinte "
"comando executará o método `start` apesar da configuração:"

#. type: delimited block . 4
#: documentation/content/en/articles/rc-scripting/_index.adoc:290
#, no-wrap
msgid "# /etc/rc.d/dummy onestart\n"
msgstr "# /etc/rc.d/dummy onestart\n"

#. type: delimited block = 4
#: documentation/content/en/articles/rc-scripting/_index.adoc:297
msgid ""
"&#10125; Now the message to be shown at boot time is no longer hard-coded in "
"the script.  It is specified by an man:rc.conf[5] variable named "
"`dummy_msg`.  This is a trivial example of how man:rc.conf[5] variables can "
"control an [.filename]#rc.d# script."
msgstr ""
"&#10125; Agora a mensagem a ser exibida na inicialização não é mais "
"codificada no script. É especificada por uma variável man:rc.conf[5] chamada "
"`dummy_msg`. Este é um exemplo trivial de como as variáveis man:rc.conf[5] "
"podem controlar um script [.filename]#rc.d#."

#. type: Plain text
#: documentation/content/en/articles/rc-scripting/_index.adoc:302
msgid ""
"The names of all man:rc.conf[5] variables used exclusively by our script "
"_must_ have the same prefix: `${name}_`.  For example: `dummy_mode`, "
"`dummy_state_file`, and so on."
msgstr ""
"Os nomes de todas as variáveis man:rc.conf[5] usadas exclusivamente pelo "
"nosso script _devem_ ter o mesmo prefixo: `${name}_`. Por exemplo: "
"`dummy_mode`, `dummy_state_file`, e assim por diante."

#. type: Plain text
#: documentation/content/en/articles/rc-scripting/_index.adoc:307
msgid ""
"While it is possible to use a shorter name internally, e.g., just `msg`, "
"adding the unique prefix `${name}_` to all global names introduced by our "
"script will save us from possible collisions with the man:rc.subr[8] "
"namespace."
msgstr ""
"Embora seja possível usar um nome mais curto internamente, por exemplo, "
"apenas `msg`, adicionar o prefixo único `${name}_` a todos os nomes globais "
"introduzidos pelo nosso script nos salvará de possíveis colisões com o "
"namespace do man:rc.subr[8]."

#. type: Plain text
#: documentation/content/en/articles/rc-scripting/_index.adoc:310
msgid ""
"As a rule, [.filename]#rc.d# scripts of the base system need not provide "
"defaults for their man:rc.conf[5] variables because the defaults should be "
"set in [.filename]#/etc/defaults/rc.conf# instead.  On the other hand, [."
"filename]#rc.d# scripts for ports should provide the defaults as shown in "
"the example."
msgstr ""
"Como regra geral, os scripts [.filename]#rc.d# do sistema base não precisam "
"fornecer valores padrão para suas variáveis man:rc.conf[5], pois os valores "
"padrão devem ser definidos em [.filename]#/etc/defaults/rc.conf#. Por outro "
"lado, os scripts [.filename]#rc.d# para ports devem fornecer os valores "
"padrão conforme mostrado no exemplo."

#. type: delimited block = 4
#: documentation/content/en/articles/rc-scripting/_index.adoc:314
msgid ""
"&#10126; Here we use `dummy_msg` to actually control our script, i.e., to "
"emit a variable message.  Use of a shell function is overkill here, since it "
"only runs a single command; an equally valid alternative is:"
msgstr ""
"&#10126; Aqui usamos `dummy_msg` para controlar nosso script, ou seja, para "
"emitir uma mensagem variável. O uso de uma função shell é excessivo aqui, "
"uma vez que ela executa apenas um único comando; uma alternativa igualmente "
"válida é:"

#. type: delimited block . 4
#: documentation/content/en/articles/rc-scripting/_index.adoc:318
#, no-wrap
msgid "start_cmd=\"echo \\\"$dummy_msg\\\"\"\n"
msgstr "start_cmd=\"echo \\\"$dummy_msg\\\"\"\n"

#. type: Title ==
#: documentation/content/en/articles/rc-scripting/_index.adoc:321
#, no-wrap
msgid "Startup and shutdown of a simple daemon"
msgstr "Inicialização e desligamento de um daemon simples"

#. type: Plain text
#: documentation/content/en/articles/rc-scripting/_index.adoc:328
msgid ""
"We said earlier that man:rc.subr[8] could provide default methods.  "
"Obviously, such defaults cannot be too general.  They are suited for the "
"common case of starting and shutting down a simple daemon program.  Let us "
"assume now that we need to write an [.filename]#rc.d# script for such a "
"daemon called `mumbled`.  Here it is:"
msgstr ""
"Dissemos anteriormente que o man:rc.subr[8] pode fornecer métodos padrões. "
"Obviamente, tais padrões não podem ser muito gerais. Eles são adequados para "
"o caso comum de iniciar e desligar um programa de daemon simples. Vamos "
"supor agora que precisamos escrever um script [.filename]#rc.d# para um "
"daemon chamado `mumbled`. Aqui está:"

#. type: delimited block . 4
#: documentation/content/en/articles/rc-scripting/_index.adoc:337
#: documentation/content/en/articles/rc-scripting/_index.adoc:394
#: documentation/content/en/articles/rc-scripting/_index.adoc:631
#, no-wrap
msgid ""
"name=mumbled\n"
"rcvar=mumbled_enable\n"
msgstr ""
"name=mumbled\n"
"rcvar=mumbled_enable\n"

#. type: delimited block . 4
#: documentation/content/en/articles/rc-scripting/_index.adoc:339
#, no-wrap
msgid "command=\"/usr/sbin/${name}\" <.>\n"
msgstr "command=\"/usr/sbin/${name}\" <.>\n"

#. type: delimited block . 4
#: documentation/content/en/articles/rc-scripting/_index.adoc:342
#: documentation/content/en/articles/rc-scripting/_index.adoc:440
#: documentation/content/en/articles/rc-scripting/_index.adoc:646
#, no-wrap
msgid ""
"load_rc_config $name\n"
"run_rc_command \"$1\"\n"
msgstr ""
"load_rc_config $name\n"
"run_rc_command \"$1\"\n"

#. type: Plain text
#: documentation/content/en/articles/rc-scripting/_index.adoc:346
msgid ""
"Pleasingly simple, isn't it? Let us examine our little script.  The only new "
"thing to note is as follows:"
msgstr ""
"Agradavelmente simples, não é? Vamos examinar nosso pequeno script. A única "
"coisa nova a observar é o seguinte:"

#. type: Plain text
#: documentation/content/en/articles/rc-scripting/_index.adoc:350
msgid ""
"&#10122; The `command` variable is meaningful to man:rc.subr[8].  If it is "
"set, man:rc.subr[8] will act according to the scenario of serving a "
"conventional daemon.  In particular, the default methods will be provided "
"for such arguments: `start`, `stop`, `restart`, `poll`, and `status`."
msgstr ""
"&#10122; A variável `command` é significativa para man:rc.subr[8]. Se ela "
"estiver definida, man:rc.subr[8] agirá de acordo com o cenário de servir a "
"um daemon convencional. Em particular, os métodos padrão serão fornecidos "
"para esses argumentos: `start`, `stop`, `restart`, `poll` e `status`."

#. type: Plain text
#: documentation/content/en/articles/rc-scripting/_index.adoc:359
msgid ""
"The daemon will be started by running `$command` with command-line flags "
"specified by `$mumbled_flags`.  Thus all the input data for the default "
"`start` method are available in the variables set by our script.  Unlike "
"`start`, other methods may require additional information about the process "
"started.  For instance, `stop` must know the PID of the process to terminate "
"it.  In the present case, man:rc.subr[8] will scan through the list of all "
"processes, looking for a process with its name equal to `procname`.  The "
"latter is another variable of meaning to man:rc.subr[8], and its value "
"defaults to that of `command`.  In other words, when we set `command`, "
"`procname` is effectively set to the same value.  This enables our script to "
"kill the daemon and to check if it is running in the first place."
msgstr ""
"O daemon será iniciado executando `$command` com as flags de linha de "
"comando especificadas por `$mumbled_flags`. Assim, todos os dados de entrada "
"para o método `start` padrão estão disponíveis nas variáveis definidas pelo "
"nosso script. Ao contrário de `start`, outros métodos podem exigir "
"informações adicionais sobre o processo iniciado. Por exemplo, `stop` deve "
"saber o PID do processo para terminá-lo. No caso presente, man:rc.subr[8] "
"irá pesquisar a lista de todos os processos, procurando por um processo com "
"o nome igual a `procname`. Este último é outra variável com significado para "
"man:rc.subr[8], e seu valor padrão é o de `command`. Em outras palavras, "
"quando definimos `command`, `procname` é efetivamente definido para o mesmo "
"valor. Isso permite que nosso script mate o daemon e verifique se ele está "
"em execução."

#. type: delimited block = 4
#: documentation/content/en/articles/rc-scripting/_index.adoc:366
msgid ""
"Some programs are in fact executable scripts.  The system runs such a script "
"by starting its interpreter and passing the name of the script to it as a "
"command-line argument.  This is reflected in the list of processes, which "
"can confuse man:rc.subr[8].  You should additionally set "
"`command_interpreter` to let man:rc.subr[8] know the actual name of the "
"process if `$command` is a script."
msgstr ""
"Algumas vezes, programas são de fato scripts executáveis. O sistema executa "
"esse script iniciando o seu interpretador e passando o nome do script como "
"um argumento na linha de comando. Isso é refletido na lista de processos, o "
"que pode confundir man:rc.subr[8]. Você deve adicionalmente definir "
"`command_interpreter` para que man:rc.subr[8] saiba o nome real do processo "
"se `$command` for um script."

#. type: delimited block = 4
#: documentation/content/en/articles/rc-scripting/_index.adoc:371
msgid ""
"For each [.filename]#rc.d# script, there is an optional man:rc.conf[5] "
"variable that takes precedence over `command`.  Its name is constructed as "
"follows: `${name}_program`, where `name` is the mandatory variable we "
"discussed <<name-var, earlier>>.  E.g., in this case it will be "
"`mumbled_program`.  It is man:rc.subr[8] that arranges `${name}_program` to "
"override `command`."
msgstr ""
"A cada script [.filename]#rc.d#, há uma variável opcional do man:rc.conf[5] "
"que tem precedência sobre `command`. Seu nome é construído da seguinte forma:"
" `${name}_program`, onde `name` é a variável obrigatória discutida "
"anteriormente. Por exemplo, neste caso, será `mumbled_program`. É o man:rc."
"subr[8] que arruma `${name}_program` para substituir `command`."

#. type: delimited block = 4
#: documentation/content/en/articles/rc-scripting/_index.adoc:375
msgid ""
"Of course, man:sh[1] will permit you to set `${name}_program` from man:rc."
"conf[5] or the script itself even if `command` is unset.  In that case, the "
"special properties of `${name}_program` are lost, and it becomes an ordinary "
"variable your script can use for its own purposes.  However, the sole use of "
"`${name}_program` is discouraged because using it together with `command` "
"became an idiom of [.filename]#rc.d# scripting."
msgstr ""
"Claro que o man:sh[1] permite definir `${name}_program` a partir do man:rc."
"conf[5] ou do próprio script, mesmo se `command` não estiver definido. Nesse "
"caso, as propriedades especiais de `${name}_program` são perdidas, e ela se "
"torna uma variável comum que o script pode usar para seus próprios fins. No "
"entanto, o uso exclusivo de `${name}_program` é desencorajado, pois usá-la "
"em conjunto com `command` se tornou idiomático em [.filename]#rc.d# "
"scripting."

#. type: Plain text
#: documentation/content/en/articles/rc-scripting/_index.adoc:378
msgid ""
"For more detailed information on default methods, refer to man:rc.subr[8]."
msgstr ""
"Para obter informações mais detalhadas sobre os métodos padrões, consulte "
"man:rc.subr[8]."

#. type: Title ==
#: documentation/content/en/articles/rc-scripting/_index.adoc:380
#, no-wrap
msgid "Startup and shutdown of an advanced daemon"
msgstr "Inicialização e desligamento de um daemon avançado"

#. type: Plain text
#: documentation/content/en/articles/rc-scripting/_index.adoc:385
msgid ""
"Let us add some meat onto the bones of the previous script and make it more "
"complex and featureful.  The default methods can do a good job for us, but "
"we may need some of their aspects tweaked.  Now we will learn how to tune "
"the default methods to our needs."
msgstr ""
"Vamos adicionar um pouco de carne aos ossos do script anterior e torná-lo "
"mais complexo e cheio de funcionalidades. Os métodos padrões podem fazer um "
"bom trabalho para nós, mas podemos precisar ajustar alguns dos seus "
"aspectos. Agora vamos aprender como ajustar os métodos padrões para as "
"nossas necessidades."

#. type: delimited block . 4
#: documentation/content/en/articles/rc-scripting/_index.adoc:397
#, no-wrap
msgid ""
"command=\"/usr/sbin/${name}\"\n"
"command_args=\"mock arguments > /dev/null 2>&1\" <.>\n"
msgstr ""
"command=\"/usr/sbin/${name}\"\n"
"command_args=\"mock arguments > /dev/null 2>&1\" <.>\n"

#. type: delimited block . 4
#: documentation/content/en/articles/rc-scripting/_index.adoc:399
#, no-wrap
msgid "pidfile=\"/var/run/${name}.pid\" <.>\n"
msgstr "pidfile=\"/var/run/${name}.pid\" <.>\n"

#. type: delimited block . 4
#: documentation/content/en/articles/rc-scripting/_index.adoc:401
#, no-wrap
msgid "required_files=\"/etc/${name}.conf /usr/share/misc/${name}.rules\" <.>\n"
msgstr ""
"required_files=\"/etc/${name}.conf /usr/share/misc/${name}.rules\" <.>\n"

#. type: delimited block . 4
#: documentation/content/en/articles/rc-scripting/_index.adoc:403
#, no-wrap
msgid "sig_reload=\"USR1\" <.>\n"
msgstr "sig_reload=\"USR1\" <.>\n"

#. type: delimited block . 4
#: documentation/content/en/articles/rc-scripting/_index.adoc:406
#, no-wrap
msgid ""
"start_precmd=\"${name}_prestart\" <.>\n"
"stop_postcmd=\"echo Bye-bye\" <.>\n"
msgstr ""
"start_precmd=\"${name}_prestart\" <.>\n"
"stop_postcmd=\"echo Bye-bye\" <.>\n"

#. type: delimited block . 4
#: documentation/content/en/articles/rc-scripting/_index.adoc:408
#, no-wrap
msgid "extra_commands=\"reload plugh xyzzy\" <.>\n"
msgstr "extra_commands=\"reload plugh xyzzy\" <.>\n"

#. type: delimited block . 4
#: documentation/content/en/articles/rc-scripting/_index.adoc:411
#, no-wrap
msgid ""
"plugh_cmd=\"mumbled_plugh\" <.>\n"
"xyzzy_cmd=\"echo 'Nothing happens.'\"\n"
msgstr ""
"plugh_cmd=\"mumbled_plugh\" <.>\n"
"xyzzy_cmd=\"echo 'Nothing happens.'\"\n"

#. type: delimited block . 4
#: documentation/content/en/articles/rc-scripting/_index.adoc:432
#, no-wrap
msgid ""
"mumbled_prestart()\n"
"{\n"
"\tif checkyesno mumbled_smart; then <.>\n"
"\t\trc_flags=\"-o smart ${rc_flags}\" <.>\n"
"\tfi\n"
"\tcase \"$mumbled_mode\" in\n"
"\tfoo)\n"
"\t\trc_flags=\"-frotz ${rc_flags}\"\n"
"\t\t;;\n"
"\tbar)\n"
"\t\trc_flags=\"-baz ${rc_flags}\"\n"
"\t\t;;\n"
"\t*)\n"
"\t\twarn \"Invalid value for mumbled_mode\" <.>\n"
"\t\treturn 1 <.>\n"
"\t\t;;\n"
"\tesac\n"
"\trun_rc_command xyzzy <.>\n"
"\treturn 0\n"
"}\n"
msgstr ""
"mumbled_prestart()\n"
"{\n"
"\tif checkyesno mumbled_smart; then <.>\n"
"\t\trc_flags=\"-o smart ${rc_flags}\" <.>\n"
"\tfi\n"
"\tcase \"$mumbled_mode\" in\n"
"\tfoo)\n"
"\t\trc_flags=\"-frotz ${rc_flags}\"\n"
"\t\t;;\n"
"\tbar)\n"
"\t\trc_flags=\"-baz ${rc_flags}\"\n"
"\t\t;;\n"
"\t*)\n"
"\t\twarn \"Invalid value for mumbled_mode\" <.>\n"
"\t\treturn 1 <.>\n"
"\t\t;;\n"
"\tesac\n"
"\trun_rc_command xyzzy <.>\n"
"\treturn 0\n"
"}\n"

#. type: delimited block . 4
#: documentation/content/en/articles/rc-scripting/_index.adoc:437
#, no-wrap
msgid ""
"mumbled_plugh() <.>\n"
"{\n"
"\techo 'A hollow voice says \"plugh\".'\n"
"}\n"
msgstr ""
"mumbled_plugh() <.>\n"
"{\n"
"\techo 'A hollow voice says \"plugh\".'\n"
"}\n"

#. type: Plain text
#: documentation/content/en/articles/rc-scripting/_index.adoc:445
msgid ""
"&#10122; Additional arguments to `$command` can be passed in "
"`command_args`.  They will be added to the command line after `"
"$mumbled_flags`.  Since the final command line is passed to `eval` for its "
"actual execution, input and output redirections can be specified in "
"`command_args`."
msgstr ""
"&#10122; Argumentos adicionais para `$command` podem ser passados em "
"`command_args`. Eles serão adicionados à linha de comando após "
"`$mumbled_flags`. Como a linha de comando final é passada para `eval` para "
"sua execução real, redirecionamentos de entrada e saída podem ser "
"especificados em `command_args`."

#. type: delimited block = 4
#: documentation/content/en/articles/rc-scripting/_index.adoc:452
msgid ""
"_Never_ include dashed options, like `-X` or `--foo`, in `command_args`.  "
"The contents of `command_args` will appear at the end of the final command "
"line, hence they are likely to follow arguments present in `${name}_flags`; "
"but most commands will not recognize dashed options after ordinary "
"arguments.  A better way of passing additional options to `$command` is to "
"add them to the beginning of `${name}_flags`.  Another way is to modify "
"`rc_flags` <<rc-flags, as shown later>>."
msgstr ""
"_Nunca_ inclua opções com hífen, como `-X` ou `--foo`, em `command_args`. O "
"conteúdo de `command_args` aparecerá no final da linha de comando final, "
"portanto, é provável que sigam argumentos presentes em `${name}_flags`; mas "
"a maioria dos comandos não reconhecerá opções com hífen após argumentos "
"comuns. Uma maneira melhor de passar opções adicionais para `$command` é "
"adicioná-las no início de `${name}_flags`. Outra maneira é modificar "
"`rc_flags` <<rc-flags, conforme mostrado posteriormente>>."

#. type: Plain text
#: documentation/content/en/articles/rc-scripting/_index.adoc:456
msgid ""
"&#10123; A good-mannered daemon should create a _pidfile_ so that its "
"process can be found more easily and reliably.  The variable `pidfile`, if "
"set, tells man:rc.subr[8] where it can find the pidfile for its default "
"methods to use."
msgstr ""
"&#10123; Um daemon bem comportado deve criar um _pidfile_ para que seu "
"processo possa ser encontrado de forma mais fácil e confiável. A variável "
"`pidfile`, se definida, informa ao man:rc.subr[8] onde ele pode encontrar o "
"pidfile para ser utilizado em seus métodos padrões."

#. type: delimited block = 4
#: documentation/content/en/articles/rc-scripting/_index.adoc:461
msgid ""
"In fact, man:rc.subr[8] will also use the pidfile to see if the daemon is "
"already running before starting it.  This check can be skipped by using the "
"`faststart` argument."
msgstr ""
"De fato, o man:rc.subr[8] também usa o pidfile para ver se o daemon já está "
"em execução antes de iniciá-lo. Essa verificação pode ser ignorada usando o "
"argumento `faststart`."

#. type: Plain text
#: documentation/content/en/articles/rc-scripting/_index.adoc:466
msgid ""
"&#10124; If the daemon cannot run unless certain files exist, just list them "
"in `required_files`, and man:rc.subr[8] will check that those files do exist "
"before starting the daemon.  There also are `required_dirs` and "
"`required_vars` for directories and environment variables, respectively.  "
"They all are described in detail in man:rc.subr[8]."
msgstr ""
"&#10124; Se o daemon não puder ser executado a menos que certos arquivos "
"existam, basta listá-los em `required_files`, e o man:rc.subr[8] verificará "
"se esses arquivos existem antes de iniciar o daemon. Existem também "
"`required_dirs` e `required_vars` para diretórios e variáveis de ambiente, "
"respectivamente. Todos eles são descritos em detalhes no man:rc.subr[8]."

#. type: delimited block = 4
#: documentation/content/en/articles/rc-scripting/_index.adoc:470
msgid ""
"The default method from man:rc.subr[8] can be forced to skip the "
"prerequisite checks by using `forcestart` as the argument to the script."
msgstr ""
"O método padrão do man:rc.subr[8] pode ser forçado a pular as verificações "
"de pré-requisito usando `forcestart` como argumento para o script."

#. type: Plain text
#: documentation/content/en/articles/rc-scripting/_index.adoc:476
msgid ""
"&#10125; We can customize signals to send to the daemon in case they differ "
"from the well-known ones.  In particular, `sig_reload` specifies the signal "
"that makes the daemon reload its configuration; it is SIGHUP by default.  "
"Another signal is sent to stop the daemon process; the default is SIGTERM, "
"but this can be changed by setting `sig_stop` appropriately."
msgstr ""
"&#10125; Podemos personalizar sinais a serem enviados ao daemon caso eles "
"difiram dos sinais conhecidos. Em particular, `sig_reload` especifica o "
"sinal que faz com que o daemon recarregue sua configuração; por padrão, é o "
"SIGHUP. Outro sinal é enviado para interromper o processo do daemon; o "
"padrão é o SIGTERM, mas isso pode ser alterado configurando `sig_stop` "
"adequadamente."

#. type: delimited block = 4
#: documentation/content/en/articles/rc-scripting/_index.adoc:481
msgid ""
"The signal names should be specified to man:rc.subr[8] without the `SIG` "
"prefix, as it is shown in the example.  The FreeBSD version of man:kill[1] "
"can recognize the `SIG` prefix, but the versions from other OS types may not."
msgstr ""
"As sinalizações devem ser especificadas para o man:rc.subr[8] sem o prefixo "
"`SIG`, como é mostrado no exemplo. A versão do FreeBSD do man:kill[1] pode "
"reconhecer o prefixo `SIG`, mas as versões de outros sistemas operacionais "
"podem não reconhecer."

#. type: Plain text
#: documentation/content/en/articles/rc-scripting/_index.adoc:486
msgid ""
"&#10126;&#10127; Performing additional tasks before or after the default "
"methods is easy.  For each command-argument supported by our script, we can "
"define `argument_precmd` and `argument_postcmd`.  These man:sh[1] commands "
"are invoked before and after the respective method, as it is evident from "
"their names."
msgstr ""
"&#10126;&#10127; Realizar tarefas adicionais antes ou depois dos métodos "
"padrões é fácil. Para cada argumento de comando suportado por nosso script, "
"podemos definir `argument_precmd` e `argument_postcmd`. Esses comandos "
"man:sh[1] são invocados antes e depois do respectivo método, como é evidente "
"pelos seus nomes."

#. type: delimited block = 4
#: documentation/content/en/articles/rc-scripting/_index.adoc:492
msgid ""
"Overriding a default method with a custom `argument_cmd` still does not "
"prevent us from making use of `argument_precmd` or `argument_postcmd` if we "
"need to.  In particular, the former is good for checking custom, "
"sophisticated conditions that should be met before performing the command "
"itself.  Using `argument_precmd` along with `argument_cmd` lets us logically "
"separate the checks from the action."
msgstr ""
"Sobrescrever um método padrão com um `argument_cmd` personalizado ainda não "
"nos impede de usar `argument_precmd` ou `argument_postcmd` se precisarmos. "
"Em particular, o primeiro é bom para verificar condições personalizadas e "
"sofisticadas que devem ser atendidas antes de executar o próprio comando. "
"Usar `argument_precmd` juntamente com `argument_cmd` nos permite separar "
"logicamente as verificações da ação."

#. type: delimited block = 4
#: documentation/content/en/articles/rc-scripting/_index.adoc:495
msgid ""
"Do not forget that you can cram any valid man:sh[1] expressions into the "
"methods, pre-, and post-commands you define.  Just invoking a function that "
"makes the real job is a good style in most cases, but never let style limit "
"your understanding of what is going on behind the curtain."
msgstr ""
"Não se esqueça de que você pode colocar qualquer expressão válida do "
"man:sh[1] nos métodos, pre e pós comandos que você define. Invocar uma "
"função que realiza o trabalho real é um bom estilo na maioria dos casos, mas "
"nunca deixe o estilo limitar sua compreensão do que está acontecendo nos "
"bastidores."

#. type: Plain text
#: documentation/content/en/articles/rc-scripting/_index.adoc:498
msgid ""
"&#10128; If we would like to implement custom arguments, which can also be "
"thought of as _commands_ to our script, we need to list them in "
"`extra_commands` and provide methods to handle them."
msgstr ""
"&#10128; Se quisermos implementar argumentos personalizados, que também "
"podem ser considerados como _comandos_ para o nosso script, precisamos listá-"
"los em `extra_commands` e fornecer métodos para lidar com eles."

#. type: delimited block = 4
#: documentation/content/en/articles/rc-scripting/_index.adoc:506
msgid ""
"The `reload` command is special. On the one hand, it has a preset method in "
"man:rc.subr[8].  On the other hand, `reload` is not offered by default.  The "
"reason is that not all daemons use the same reload mechanism and some have "
"nothing to reload at all.  So we need to ask explicitly that the builtin "
"functionality be provided.  We can do so via `extra_commands`."
msgstr ""
"O comando `reload` é especial. Por um lado, ele possui um método predefinido "
"em man:rc.subr[8]. Por outro lado, `reload` não é oferecido por padrão. A "
"razão é que nem todos os daemons usam o mesmo mecanismo de recarga e alguns "
"não têm nada para recarregar. Portanto, precisamos pedir explicitamente que "
"a funcionalidade integrada seja fornecida. Podemos fazer isso por meio de "
"`extra_commands`."

#. type: delimited block = 4
#: documentation/content/en/articles/rc-scripting/_index.adoc:510
msgid ""
"What do we get from the default method for `reload`? Quite often daemons "
"reload their configuration upon reception of a signal - typically, SIGHUP.  "
"Therefore man:rc.subr[8] attempts to reload the daemon by sending a signal "
"to it.  The signal is preset to SIGHUP but can be customized via "
"`sig_reload` if necessary."
msgstr ""
"O que recebemos do método padrão para `reload`? Muitas vezes, os daemons "
"recarregam sua configuração após receber um sinal - geralmente, SIGHUP. "
"Portanto, o man:rc.subr[8] tenta recarregar o daemon enviando um sinal para "
"ele. O sinal é pré-definido como SIGHUP, mas pode ser personalizado via "
"`sig_reload`, se necessário."

#. type: Plain text
#: documentation/content/en/articles/rc-scripting/_index.adoc:515
msgid ""
"&#10129;&#9454; Our script supports two non-standard commands, `plugh` and "
"`xyzzy`.  We saw them listed in `extra_commands`, and now it is time to "
"provide methods for them.  The method for `xyzzy` is just inlined while that "
"for `plugh` is implemented as the `mumbled_plugh` function."
msgstr ""
"&#10129;&#9454; O nosso script suporta dois comandos não padrão, `plugh` e "
"`xyzzy`. Nós os vimos listados em `extra_commands`, e agora é hora de "
"fornecer métodos para eles. O método para `xyzzy` é apenas inserido em linha "
"enquanto que para `plugh` é implementado como a função `mumbled_plugh`."

#. type: Plain text
#: documentation/content/en/articles/rc-scripting/_index.adoc:519
msgid ""
"Non-standard commands are not invoked during startup or shutdown.  Usually "
"they are for the system admin's convenience.  They can also be used from "
"other subsystems, e.g., man:devd[8] if specified in man:devd.conf[5]."
msgstr ""
"Comandos não padrão não são invocados durante a inicialização ou "
"desligamento. Geralmente, eles são para a conveniência do administrador do "
"sistema. Eles também podem ser usados em outros subsistemas, por exemplo, o "
"man:devd[8] se especificados em man:devd.conf[5]."

#. type: Plain text
#: documentation/content/en/articles/rc-scripting/_index.adoc:522
msgid ""
"The full list of available commands can be found in the usage line printed "
"by man:rc.subr[8] when the script is invoked without arguments.  For "
"example, here is the usage line from the script under study:"
msgstr ""
"A lista completa de comandos disponíveis pode ser encontrada na linha de uso "
"impressa pelo man:rc.subr[8] quando o script é invocado sem argumentos. Por "
"exemplo, aqui está a linha de uso do script em estudo:"

#. type: delimited block . 4
#: documentation/content/en/articles/rc-scripting/_index.adoc:527
#, no-wrap
msgid ""
"# /etc/rc.d/mumbled\n"
"Usage: /etc/rc.d/mumbled [fast|force|one](start|stop|restart|rcvar|reload|plugh|xyzzy|status|poll)\n"
msgstr ""
"# /etc/rc.d/mumbled\n"
"Usage: /etc/rc.d/mumbled "
"[fast|force|one](start|stop|restart|rcvar|reload|plugh|xyzzy|status|poll)\n"

#. type: Plain text
#: documentation/content/en/articles/rc-scripting/_index.adoc:534
msgid ""
"&#9453; A script can invoke its own standard or non-standard commands if "
"needed.  This may look similar to calling functions, but we know that "
"commands and shell functions are not always the same thing.  For instance, "
"`xyzzy` is not implemented as a function here.  In addition, there can be a "
"pre-command and post-command, which should be invoked orderly.  So the "
"proper way for a script to run its own command is by means of man:rc."
"subr[8], as shown in the example."
msgstr ""
"&#9453; Um script pode invocar seus próprios comandos padrão ou não-padrão, "
"se necessário. Isso pode parecer semelhante a chamar funções, mas sabemos "
"que comandos e funções do shell nem sempre são a mesma coisa. Por exemplo, "
"`xyzzy` não é implementado como uma função aqui. Além disso, pode haver um "
"pré-comando e um pós-comando, que devem ser invocados ordenadamente. "
"Portanto, a maneira adequada para um script executar seu próprio comando é "
"por meio do man:rc.subr[8], como mostrado no exemplo."

#. type: Plain text
#: documentation/content/en/articles/rc-scripting/_index.adoc:540
msgid ""
"&#10130; A handy function named `checkyesno` is provided by man:rc.subr[8].  "
"It takes a variable name as its argument and returns a zero exit code if and "
"only if the variable is set to `YES`, or `TRUE`, or `ON`, or `1`, case "
"insensitive; a non-zero exit code is returned otherwise.  In the latter "
"case, the function tests the variable for being set to `NO`, `FALSE`, `OFF`, "
"or `0`, case insensitive; it prints a warning message if the variable "
"contains anything else, i.e., junk."
msgstr ""
"&#10130; Uma função útil chamada `checkyesno` é fornecida pelo man:rc.subr[8]"
". Ela recebe um nome de variável como argumento e retorna um código de saída "
"zero se e somente se a variável estiver definida como `YES`, ou `TRUE`, ou "
"`ON`, ou `1`, insensível a maiúsculas e minúsculas; um código de saída não-"
"zero é retornado caso contrário. Neste último caso, a função testa se a "
"variável está definida como `NO`, `FALSE`, `OFF` ou `0`, insensível a "
"maiúsculas e minúsculas; ela imprime uma mensagem de aviso se a variável "
"contiver qualquer outra coisa, ou seja, lixo."

#. type: Plain text
#: documentation/content/en/articles/rc-scripting/_index.adoc:542
msgid ""
"Keep in mind that for man:sh[1] a zero exit code means true and a non-zero "
"exit code means false."
msgstr ""
"Tenha em mente que para o man:sh[1], um código de saída zero significa "
"verdadeiro e um código de saída não-zero significa falso."

#. type: delimited block = 4
#: documentation/content/en/articles/rc-scripting/_index.adoc:547
msgid ""
"The `checkyesno` function takes a __variable name__.  Do not pass the "
"expanded _value_ of a variable to it; it will not work as expected."
msgstr ""
"A função `checkyesno` recebe um __nome de variável__. Não passe o _valor "
"expandido_ de uma variável para ela; isso não funcionará como esperado."

#. type: delimited block = 4
#: documentation/content/en/articles/rc-scripting/_index.adoc:549
msgid "The following is the correct usage of `checkyesno`:"
msgstr "Aqui está o uso correto de `checkyesno`:"

#. type: delimited block . 4
#: documentation/content/en/articles/rc-scripting/_index.adoc:555
#, no-wrap
msgid ""
"if checkyesno mumbled_enable; then\n"
"        foo\n"
"fi\n"
msgstr ""
"if checkyesno mumbled_enable; then\n"
"        foo\n"
"fi\n"

#. type: Plain text
#: documentation/content/en/articles/rc-scripting/_index.adoc:558
msgid ""
"On the contrary, calling `checkyesno` as shown below will not work - at "
"least not as expected:"
msgstr ""
"Ao contrário, chamar `checkyesno` como mostrado abaixo não funcionará - pelo "
"menos não como esperado:"

#. type: delimited block . 4
#: documentation/content/en/articles/rc-scripting/_index.adoc:564
#, no-wrap
msgid ""
"if checkyesno \"${mumbled_enable}\"; then\n"
"        foo\n"
"fi\n"
msgstr ""
"if checkyesno \"${mumbled_enable}\"; then\n"
"        foo\n"
"fi\n"

#. type: delimited block = 4
#: documentation/content/en/articles/rc-scripting/_index.adoc:569
msgid ""
"&#10131; [[rc-flags]]We can affect the flags to be passed to `$command` by "
"modifying `rc_flags` in `$start_precmd`."
msgstr ""
"&#10131; [[rc-flags]]Podemos afetar as flags que serão passadas para "
"`$command` modificando `rc_flags` em `$start_precmd`."

#. type: delimited block = 4
#: documentation/content/en/articles/rc-scripting/_index.adoc:573
msgid ""
"&#9451; In certain cases we may need to emit an important message that "
"should go to `syslog` as well.  This can be done easily with the following "
"man:rc.subr[8] functions: `debug`, `info`, `warn`, and `err`.  The latter "
"function then exits the script with the code specified."
msgstr ""
"&#9451; Em certos casos, podemos precisar emitir uma mensagem importante que "
"também deve ser registrada no `syslog`. Isso pode ser feito facilmente com "
"as seguintes funções do man:rc.subr[8]: `debug`, `info`, `warn` e `err`. "
"Esta última função finaliza o script com o código especificado."

#. type: delimited block = 4
#: documentation/content/en/articles/rc-scripting/_index.adoc:577
msgid ""
"&#9452; The exit codes from methods and their pre-commands are not just "
"ignored by default.  If `argument_precmd` returns a non-zero exit code, the "
"main method will not be performed.  In turn, `argument_postcmd` will not be "
"invoked unless the main method returns a zero exit code."
msgstr ""
"&#9452; Os códigos de saída dos métodos e seus pre-comandos não são apenas "
"ignorados por padrão. Se `argument_precmd` retornar um código de saída "
"diferente de zero, o método principal não será executado. Por sua vez, "
"`argument_postcmd` não será chamado, a menos que o método principal retorne "
"um código de saída igual a zero."

#. type: Plain text
#: documentation/content/en/articles/rc-scripting/_index.adoc:581
msgid ""
"However, man:rc.subr[8] can be instructed from the command line to ignore "
"those exit codes and invoke all commands anyway by prefixing an argument "
"with `force`, as in `forcestart`."
msgstr ""
"Entretanto, é possível instruir o man:rc.subr[8] a ignorar esses códigos de "
"saída e executar todos os comandos mesmo assim, adicionando um argumento com "
"o prefixo `force`, como em `forcestart`."

#. type: Title ==
#: documentation/content/en/articles/rc-scripting/_index.adoc:584
#, no-wrap
msgid "Connecting a script to the rc.d framework"
msgstr "Conectando um script ao framework rc.d"

#. type: delimited block = 4
#: documentation/content/en/articles/rc-scripting/_index.adoc:591
msgid ""
"After a script has been written, it needs to be integrated into [."
"filename]#rc.d#.  The crucial step is to install the script in [.filename]#/"
"etc/rc.d# (for the base system) or [.filename]#/usr/local/etc/rc.d# (for "
"ports).  Both [.filename]#bsd.prog.mk# and [.filename]#bsd.port.mk# provide "
"convenient hooks for that, and usually you do not have to worry about the "
"proper ownership and mode.  System scripts should be installed from [."
"filename]#src/libexec/rc/rc.d# through the [.filename]#Makefile# found "
"there.  Port scripts can be installed using `USE_RC_SUBR` as described "
"extref:{porters-handbook}[in the Porter's Handbook, rc-scripts]."
msgstr ""
"Depois que um script é escrito, ele precisa ser integrado ao [.filename]#rc."
"d#. O passo crucial é instalar o script em [.filename]#/etc/rc.d# (para o "
"sistema base) ou [.filename]#/usr/local/etc/rc.d# (para o ports). Tanto o [."
"filename]#bsd.prog.mk# quanto o [.filename]#bsd.port.mk# fornecem ganchos "
"convenientes para isso, e geralmente você não precisa se preocupar com a "
"propriedade e o modo adequados. Os scripts do sistema devem ser instalados a "
"partir de [.filename]#src/libexec/rc/rc.d# através do [.filename]#Makefile# "
"encontrado lá. Scripts de ports podem ser instalados usando `USE_RC_SUBR` "
"como descrito no extref:{porters-handbook}[Porter's Handbook, rc-scripts]."

#. type: delimited block = 4
#: documentation/content/en/articles/rc-scripting/_index.adoc:596
msgid ""
"However, we should consider beforehand the place of our script in the system "
"startup sequence.  The service handled by our script is likely to depend on "
"other services.  For instance, a network daemon cannot function without the "
"network interfaces and routing up and running.  Even if a service seems to "
"demand nothing, it can hardly start before the basic filesystems have been "
"checked and mounted."
msgstr ""
"No entanto, devemos considerar antecipadamente o local do nosso script na "
"sequência de inicialização do sistema. O serviço manipulado pelo nosso "
"script provavelmente depende de outros serviços. Por exemplo, um daemon de "
"rede não pode funcionar sem as interfaces de rede e o roteamento em "
"funcionamento. Mesmo que um serviço pareça não exigir nada, dificilmente "
"pode ser iniciado antes que os sistemas de arquivos básicos tenham sido "
"verificados e montados."

#. type: delimited block = 4
#: documentation/content/en/articles/rc-scripting/_index.adoc:602
msgid ""
"We mentioned man:rcorder[8] already.  Now it is time to have a close look at "
"it.  In a nutshell, man:rcorder[8] takes a set of files, examines their "
"contents, and prints a dependency-ordered list of files from the set to "
"`stdout`.  The point is to keep dependency information _inside_ the files so "
"that each file can speak for itself only.  A file can specify the following "
"information:"
msgstr ""
"Nós já mencionamos o man:rcorder[8]. Agora é hora de dar uma olhada mais de "
"perto nele. Em poucas palavras, o man:rcorder[8] pega um conjunto de "
"arquivos, examina seus conteúdos e imprime uma lista ordenada por "
"dependência dos arquivos do conjunto no `stdout`. O objetivo é manter as "
"informações de dependência _dentro_ dos arquivos, de modo que cada arquivo "
"possa falar apenas por si mesmo. Um arquivo pode especificar as seguintes "
"informações:"

#. type: delimited block = 4
#: documentation/content/en/articles/rc-scripting/_index.adoc:604
msgid ""
"the names of the \"conditions\" (which means services to us) it __provides__;"
msgstr ""
"os nomes das \"condições\" (ou seja, serviços para nós) que ele __fornece__;"

#. type: delimited block = 4
#: documentation/content/en/articles/rc-scripting/_index.adoc:605
msgid "the names of the \"conditions\" it __requires__;"
msgstr "os nomes das \"condições\" que ele __requer__;"

#. type: delimited block = 4
#: documentation/content/en/articles/rc-scripting/_index.adoc:606
msgid "the names of the \"conditions\" this file should run __before__;"
msgstr ""
"os nomes das \"condições\" que este arquivo deve ser executado __antes__;"

#. type: delimited block = 4
#: documentation/content/en/articles/rc-scripting/_index.adoc:607
msgid ""
"additional _keywords_ that can be used to select a subset from the whole set "
"of files (man:rcorder[8] can be instructed via options to include or omit "
"the files having particular keywords listed.)"
msgstr ""
"palavras-chave adicionais que podem ser usadas para selecionar um "
"subconjunto do conjunto completo de arquivos (man:rcorder[8] pode ser "
"instruído via opções para incluir ou omitir os arquivos que possuem "
"determinadas palavras-chave listadas.)"

#. type: delimited block = 4
#: documentation/content/en/articles/rc-scripting/_index.adoc:612
msgid ""
"It is no surprise that man:rcorder[8] can handle only text files with a "
"syntax close to that of man:sh[1].  That is, special lines understood by man:"
"rcorder[8] look like man:sh[1] comments.  The syntax of such special lines "
"is rather rigid to simplify their processing.  See man:rcorder[8] for "
"details."
msgstr ""
"Não é surpresa que o man:rcorder[8] possa lidar apenas com arquivos de texto "
"com uma sintaxe próxima à do man:sh[1]. Ou seja, as linhas especiais "
"entendidas pelo man:rcorder[8] se parecem com comentários do man:sh[1]. A "
"sintaxe dessas linhas especiais é bastante rígida para simplificar seu "
"processamento. Consulte man:rcorder[8] para obter detalhes."

#. type: delimited block = 4
#: documentation/content/en/articles/rc-scripting/_index.adoc:615
msgid ""
"Besides using man:rcorder[8] special lines, a script can insist on its "
"dependency upon another service by just starting it forcibly.  This can be "
"needed when the other service is optional and will not start by itself "
"because the system admin has disabled it mistakenly in man:rc.conf[5]."
msgstr ""
"Além de usar as linhas especiais entendidas pelo man:rcorder[8], um script "
"pode exigir sua dependência de outro serviço simplesmente iniciando-o "
"forçadamente. Isso pode ser necessário quando o outro serviço é opcional e "
"não iniciará por si só porque o administrador do sistema o desativou por "
"engano em man:rc.conf[5]."

#. type: delimited block = 4
#: documentation/content/en/articles/rc-scripting/_index.adoc:617
msgid ""
"With this general knowledge in mind, let us consider the simple daemon "
"script enhanced with dependency stuff:"
msgstr ""
"Com este conhecimento geral em mente, vamos considerar o simples script "
"daemon aprimorado com coisas de dependência:"

#. type: delimited block . 4
#: documentation/content/en/articles/rc-scripting/_index.adoc:626
#, no-wrap
msgid ""
"# PROVIDE: mumbled oldmumble <.>\n"
"# REQUIRE: DAEMON cleanvar frotz <.>\n"
"# BEFORE:  LOGIN <.>\n"
"# KEYWORD: nojail shutdown <.>\n"
msgstr ""
"# PROVIDE: mumbled oldmumble <.>\n"
"# REQUIRE: DAEMON cleanvar frotz <.>\n"
"# BEFORE:  LOGIN <.>\n"
"# KEYWORD: nojail shutdown <.>\n"

#. type: delimited block . 4
#: documentation/content/en/articles/rc-scripting/_index.adoc:634
#, no-wrap
msgid ""
"command=\"/usr/sbin/${name}\"\n"
"start_precmd=\"${name}_prestart\"\n"
msgstr ""
"command=\"/usr/sbin/${name}\"\n"
"start_precmd=\"${name}_prestart\"\n"

#. type: delimited block . 4
#: documentation/content/en/articles/rc-scripting/_index.adoc:643
#, no-wrap
msgid ""
"mumbled_prestart()\n"
"{\n"
"\tif ! checkyesno frotz_enable && \\\n"
"\t    ! /etc/rc.d/frotz forcestatus 1>/dev/null 2>&1; then\n"
"\t\tforce_depend frotz || return 1 <.>\n"
"\tfi\n"
"\treturn 0\n"
"}\n"
msgstr ""
"mumbled_prestart()\n"
"{\n"
"\tif ! checkyesno frotz_enable && \\\n"
"\t    ! /etc/rc.d/frotz forcestatus 1>/dev/null 2>&1; then\n"
"\t\tforce_depend frotz || return 1 <.>\n"
"\tfi\n"
"\treturn 0\n"
"}\n"

#. type: Plain text
#: documentation/content/en/articles/rc-scripting/_index.adoc:649
msgid "As before, detailed analysis follows:"
msgstr "Como antes, a análise detalhada segue:"

#. type: Plain text
#: documentation/content/en/articles/rc-scripting/_index.adoc:652
msgid ""
"&#10122; That line declares the names of \"conditions\" our script "
"provides.  Now other scripts can record a dependency on our script by those "
"names."
msgstr ""
"&#10122; Essa linha declara os nomes das \"condições\" que nosso script "
"fornece. Agora, outros scripts podem registrar uma dependência em nosso "
"script por esses nomes."

#. type: delimited block = 4
#: documentation/content/en/articles/rc-scripting/_index.adoc:657
msgid ""
"Usually a script specifies a single condition provided.  However, nothing "
"prevents us from listing several conditions there, e.g., for compatibility "
"reasons."
msgstr ""
"Geralmente, um script especifica uma única condição fornecida. No entanto, "
"nada nos impede de listar várias condições, por exemplo, por razões de "
"compatibilidade."

#. type: delimited block = 4
#: documentation/content/en/articles/rc-scripting/_index.adoc:659
msgid ""
"In any case, the name of the main, or the only, `PROVIDE:` condition should "
"be the same as `${name}`."
msgstr ""
"Em qualquer caso, o nome da condição principal, ou única, `PROVIDE:` deve "
"ser o mesmo que `${name}`."

#. type: Plain text
#: documentation/content/en/articles/rc-scripting/_index.adoc:663
msgid ""
"&#10123;&#10124; So our script indicates which \"conditions\" provided by "
"other scripts it depends on.  According to the lines, our script asks man:"
"rcorder[8] to put it after the script(s) providing [.filename]#DAEMON# and [."
"filename]#cleanvar#, but before that providing [.filename]#LOGIN#."
msgstr ""
"&#10123;&#10124; Então, nosso script indica em quais \"condições\" "
"fornecidas por outros scripts ele depende. De acordo com as linhas, nosso "
"script pede para o man:rcorder[8] colocá-lo após o(s) script(s) fornecendo o "
"[.filename]#DAEMON# e o [.filename]#cleanvar#, mas antes daquele que fornece "
"[.filename]#LOGIN#."

#. type: delimited block = 4
#: documentation/content/en/articles/rc-scripting/_index.adoc:669
msgid ""
"The `BEFORE:` line should not be abused to work around an incomplete "
"dependency list in the other script.  The appropriate case for using `BEFORE:"
"` is when the other script does not care about ours, but our script can do "
"its task better if run before the other one.  A typical real-life example is "
"the network interfaces vs. the firewall: While the interfaces do not depend "
"on the firewall in doing their job, the system security will benefit from "
"the firewall being ready before there is any network traffic."
msgstr ""
"A linha `BEFORE:` não deve ser usada para contornar uma lista de "
"dependências incompleta em outro script. O caso apropriado para usar "
"`BEFORE:` é quando o outro script não se importa com o nosso, mas nosso "
"script pode executar sua tarefa melhor se for executado antes do outro. Um "
"exemplo típico da vida real é a relação entre as interfaces de rede e o "
"firewall: embora as interfaces não dependam do firewall para fazer o "
"trabalho delas, a segurança do sistema se beneficiará se o firewall estiver "
"pronto antes de haver qualquer tráfego de rede."

#. type: delimited block = 4
#: documentation/content/en/articles/rc-scripting/_index.adoc:673
msgid ""
"Besides conditions corresponding to a single service each, there are meta-"
"conditions and their \"placeholder\" scripts used to ensure that certain "
"groups of operations are performed before others.  These are denoted by [."
"filename]#UPPERCASE# names.  Their list and purposes can be found in man:"
"rc[8]."
msgstr ""
"Além das condições correspondentes a um único serviço, existem meta-"
"condições e seus scripts \"placeholder\" usados para garantir que certos "
"grupos de operações sejam executados antes de outros. Estes são denotados "
"por nomes em [.filename]#UPPERCASE#. Sua lista e propósitos podem ser "
"encontrados no manual man:rc[8]."

#. type: delimited block = 4
#: documentation/content/en/articles/rc-scripting/_index.adoc:679
msgid ""
"Keep in mind that putting a service name in the `REQUIRE:` line does not "
"guarantee that the service will actually be running by the time our script "
"starts.  The required service may fail to start or just be disabled in man:"
"rc.conf[5].  Obviously, man:rcorder[8] cannot track such details, and man:"
"rc[8] will not do that either.  Consequently, the application started by our "
"script should be able to cope with any required services being unavailable.  "
"In certain cases, we can help it as discussed <<forcedep, below>>"
msgstr ""
"Lembre-se de que colocar o nome de um serviço na linha `REQUIRE:` não "
"garante que o serviço realmente estará em execução no momento em que o "
"script começar. O serviço necessário pode falhar ao iniciar ou simplesmente "
"ser desativado em man:rc.conf[5]. Obviamente, o man:rcorder[8] não pode "
"controlar esses detalhes e o man:rc[8] também não fará isso. "
"Consequentemente, a aplicação iniciada pelo nosso script deve ser capaz de "
"lidar com qualquer serviço necessário que esteja indisponível. Em certos "
"casos, podemos ajudá-lo conforme discutido <<forcedep, abaixo>>"

#. type: Plain text
#: documentation/content/en/articles/rc-scripting/_index.adoc:684
msgid ""
"[[keywords]]&#10125; As we remember from the above text, man:rcorder[8] "
"keywords can be used to select or leave out some scripts.  Namely any man:"
"rcorder[8] consumer can specify through `-k` and `-s` options which keywords "
"are on the \"keep list\" and \"skip list\", respectively.  From all the "
"files to be dependency sorted, man:rcorder[8] will pick only those having a "
"keyword from the keep list (unless empty) and not having a keyword from the "
"skip list."
msgstr ""
"[[keywords]]&#10125; Como lembramos do texto acima, as palavras-chave do "
"man:rcorder[8] podem ser usadas para selecionar ou deixar de fora alguns "
"scripts. Qualquer consumidor do man:rcorder[8] pode especificar, através das "
"opções `-k` e `-s`, quais palavras-chave estarão na \"lista de manutenção\" "
"e na \"lista de exclusão\", respectivamente. De todos os arquivos a serem "
"ordenados por dependência, man:rcorder[8] escolherá apenas aqueles que "
"tiverem uma palavra-chave da lista de manutenção (a menos que esteja vazia) "
"e que não tiverem uma palavra-chave da lista de exclusão."

#. type: Plain text
#: documentation/content/en/articles/rc-scripting/_index.adoc:687
msgid ""
"In FreeBSD, man:rcorder[8] is used by [.filename]#/etc/rc# and [.filename]#/"
"etc/rc.shutdown#.  These two scripts define the standard list of FreeBSD [."
"filename]#rc.d# keywords and their meanings as follows:"
msgstr ""
"No FreeBSD, o man:rcorder[8] é usado por [.filename]#/etc/rc# e [.filename]#/"
"etc/rc.shutdown#. Esses dois scripts definem a lista padrão de palavras-"
"chaves do FreeBSD [.filename]#rc.d# e seus significados da seguinte forma:"

#. type: Labeled list
#: documentation/content/en/articles/rc-scripting/_index.adoc:688
#, no-wrap
msgid "nojail"
msgstr "nojail"

#. type: Plain text
#: documentation/content/en/articles/rc-scripting/_index.adoc:690
msgid ""
"The service is not for man:jail[8] environment.  The automatic startup and "
"shutdown procedures will ignore the script if inside a jail."
msgstr ""
"O serviço não é para ambiente man:jail[8]. Os procedimentos automáticos de "
"inicialização e desligamento ignorarão o script se estiver dentro de uma "
"jail."

#. type: Labeled list
#: documentation/content/en/articles/rc-scripting/_index.adoc:691
#, no-wrap
msgid "nostart"
msgstr "nostart"

#. type: Plain text
#: documentation/content/en/articles/rc-scripting/_index.adoc:694
msgid ""
"The service is to be started manually or not started at all.  The automatic "
"startup procedure will ignore the script.  In conjunction with the [."
"filename]#shutdown# keyword, this can be used to write scripts that do "
"something only at system shutdown."
msgstr ""
"O serviço deve ser iniciado manualmente ou não iniciado de forma alguma. O "
"procedimento de inicialização automático ignorará o script. Em conjunto com "
"a palavra-chave [.filename]#shutdown#, isso pode ser usado para escrever "
"scripts que fazem algo apenas no desligamento do sistema."

#. type: Labeled list
#: documentation/content/en/articles/rc-scripting/_index.adoc:695
#, no-wrap
msgid "shutdown"
msgstr "shutdown"

#. type: Plain text
#: documentation/content/en/articles/rc-scripting/_index.adoc:696
msgid ""
"This keyword is to be listed __explicitly__ if the service needs to be "
"stopped before system shutdown."
msgstr ""
"Este palavra-chave deve ser listada de forma __explícita__ se o serviço "
"precisa ser parado antes do desligamento do sistema."

#. type: delimited block = 4
#: documentation/content/en/articles/rc-scripting/_index.adoc:709
msgid ""
"When the system is going to shut down, [.filename]#/etc/rc.shutdown# runs.  "
"It assumes that most [.filename]#rc.d# scripts have nothing to do at that "
"time.  Therefore [.filename]#/etc/rc.shutdown# selectively invokes [."
"filename]#rc.d# scripts with the [.filename]#shutdown# keyword, effectively "
"ignoring the rest of the scripts.  For even faster shutdown, [.filename]#/"
"etc/rc.shutdown# passes the [.filename]#faststop# command to the scripts it "
"runs so that they skip preliminary checks, e.g., the pidfile check.  As "
"dependent services should be stopped before their prerequisites, [."
"filename]#/etc/rc.shutdown# runs the scripts in reverse dependency order.  "
"If writing a real [.filename]#rc.d# script, you should consider whether it "
"is relevant at system shutdown time.  E.g., if your script does its work in "
"response to the [.filename]#start# command only, then you need not to "
"include this keyword.  However, if your script manages a service, it is "
"probably a good idea to stop it before the system proceeds to the final "
"stage of its shutdown sequence described in man:halt[8].  In particular, a "
"service should be stopped explicitly if it needs considerable time or "
"special actions to shut down cleanly.  A typical example of such a service "
"is a database engine."
msgstr ""
"Quando o sistema está prestes a desligar, o arquivo [.filename]#/etc/rc."
"shutdown# é executado. Ele assume que a maioria dos scripts [.filename]#rc.d#"
" não tem nada a fazer nesse momento. Portanto, o [.filename]#/etc/rc."
"shutdown# invoca seletivamente scripts [.filename]#rc.d# com a palavra-chave "
"[.filename]#shutdown#, ignorando efetivamente o restante dos scripts. Para "
"desligamento ainda mais rápido, o [.filename]#/etc/rc.shutdown# passa o "
"comando [.filename]#faststop# para os scripts que executa para que eles "
"pulem verificações preliminares, como a verificação do pidfile. Como os "
"serviços dependentes devem ser interrompidos antes de suas dependências, o [."
"filename]#/etc/rc.shutdown# executa os scripts em ordem de dependência "
"reversa. Se você está escrevendo um script [.filename]#rc.d# real, deve "
"considerar se ele é relevante no momento do desligamento do sistema. Por "
"exemplo, se o seu script faz seu trabalho apenas em resposta ao comando [."
"filename]#start#, então você não precisa incluir essa palavra-chave. No "
"entanto, se o seu script gerencia um serviço, é provavelmente uma boa ideia "
"pará-lo antes que o sistema prossiga para o estágio final de sua sequência "
"de desligamento descrita em man:halt[8]. Em particular, um serviço deve ser "
"interrompido explicitamente se precisar de tempo considerável ou ações "
"especiais para ser desligado corretamente. Um exemplo típico desse tipo de "
"serviço é um mecanismo de banco de dados."

#. type: Plain text
#: documentation/content/en/articles/rc-scripting/_index.adoc:713
msgid ""
"[[forcedep]]&#10126; To begin with, `force_depend` should be used with much "
"care.  It is generally better to revise the hierarchy of configuration "
"variables for your [.filename]#rc.d# scripts if they are interdependent."
msgstr ""
"[[forcedep]] &#10126; Em primeiro lugar, `force_depend` deve ser usado com "
"muito cuidado. Geralmente, é melhor revisar a hierarquia das variáveis de "
"configuração para seus scripts [.filename]#rc.d# se eles são "
"interdependentes."

#. type: Plain text
#: documentation/content/en/articles/rc-scripting/_index.adoc:722
msgid ""
"If you still cannot do without `force_depend`, the example offers an idiom "
"of how to invoke it conditionally.  In the example, our `mumbled` daemon "
"requires that another one, `frotz`, be started in advance.  However, `frotz` "
"is optional, too; and man:rcorder[8] knows nothing about such details.  "
"Fortunately, our script has access to all man:rc.conf[5] variables.  If "
"`frotz_enable` is true, we hope for the best and rely on [.filename]#rc.d# "
"to have started `frotz`.  Otherwise we forcibly check the status of "
"`frotz`.  Finally, we enforce our dependency on `frotz` if it is found to be "
"not running.  A warning message will be emitted by `force_depend` because it "
"should be invoked only if a misconfiguration has been detected."
msgstr ""
"Se ainda assim você não puder abrir mão do `force_depend`, o exemplo oferece "
"um exemplo de como invocá-lo condicionalmente. No exemplo, nosso daemon "
"`mumbled` requer que outro daemon, `frotz`, seja iniciado antecipadamente. "
"No entanto, `frotz` também é opcional; e o man:rcorder[8] não conhece esses "
"detalhes. Felizmente, nosso script tem acesso a todas as variáveis de man:rc."
"conf[5]. Se `frotz_enable` for verdadeiro, esperamos o melhor e confiamos no "
"[.filename]#rc.d# para ter iniciado `frotz`. Caso contrário, verificamos "
"forçadamente o status de `frotz`. Finalmente, impomos nossa dependência em "
"`frotz` se ele não estiver em execução. Uma mensagem de aviso será emitida "
"por `force_depend`, pois ele só deve ser invocado se uma configuração "
"incorreta for detectada."

#. type: Title ==
#: documentation/content/en/articles/rc-scripting/_index.adoc:724
#, no-wrap
msgid "Giving more flexibility to an rc.d script"
msgstr "Dando mais flexibilidade a um script rc.d"

#. type: Plain text
#: documentation/content/en/articles/rc-scripting/_index.adoc:733
msgid ""
"When invoked during startup or shutdown, an [.filename]#rc.d# script is "
"supposed to act on the entire subsystem it is responsible for.  E.g., [."
"filename]#/etc/rc.d/netif# should start or stop all network interfaces "
"described by man:rc.conf[5].  Either task can be uniquely indicated by a "
"single command argument such as `start` or `stop`.  Between startup and "
"shutdown, [.filename]#rc.d# scripts help the admin to control the running "
"system, and it is when the need for more flexibility and precision arises.  "
"For instance, the admin may want to add the settings of a new network "
"interface to man:rc.conf[5] and then to start it without interfering with "
"the operation of the existing interfaces.  Next time the admin may need to "
"shut down a single network interface.  In the spirit of the command line, "
"the respective [.filename]#rc.d# script calls for an extra argument, the "
"interface name."
msgstr ""
"Quando invocado durante a inicialização ou desligamento, um script [."
"filename]#rc.d# deve agir em todo o subsistema pelo qual é responsável. Por "
"exemplo, o [.filename]#/etc/rc.d/netif# deve iniciar ou parar todas as "
"interfaces de rede descritas em man:rc.conf[5]. Cada tarefa pode ser "
"indicada por um único argumento de comando, como `start` ou `stop`. Entre a "
"inicialização e o desligamento, os scripts [.filename]#rc.d# ajudam o "
"administrador a controlar o sistema em execução e é quando surge a "
"necessidade de mais flexibilidade e precisão. Por exemplo, o administrador "
"pode querer adicionar as configurações de uma nova interface de rede em "
"man:rc.conf[5] e, em seguida, iniciá-la sem interferir na operação das "
"interfaces existentes. Na próxima vez, o administrador pode precisar "
"desligar uma única interface de rede. Para facilitar o uso na linha de "
"comando, o respectivo script [.filename]#rc.d# pede um argumento extra, o "
"nome da interface."

#. type: Plain text
#: documentation/content/en/articles/rc-scripting/_index.adoc:736
msgid ""
"Fortunately, man:rc.subr[8] allows for passing any number of arguments to "
"script's methods (within the system limits).  Due to that, the changes in "
"the script itself can be minimal."
msgstr ""
"Felizmente, o man:rc.subr[8] permite passar qualquer número de argumentos "
"para os métodos do script (dentro dos limites do sistema). Devido a isso, as "
"mudanças no próprio script podem ser mínimas."

#. type: Plain text
#: documentation/content/en/articles/rc-scripting/_index.adoc:741
msgid ""
"How can man:rc.subr[8] gain access to the extra command-line arguments.  "
"Should it just grab them directly? Not by any means.  Firstly, an man:sh[1] "
"function has no access to the positional parameters of its caller, but man:"
"rc.subr[8] is just a sack of such functions.  Secondly, the good manner of [."
"filename]#rc.d# dictates that it is for the main script to decide which "
"arguments are to be passed to its methods."
msgstr ""
"Como o man:rc.subr[8] pode ter acesso aos argumentos adicionais da linha de "
"comando? Ele deve simplesmente pegá-los diretamente? De maneira alguma! Em "
"primeiro lugar, uma função do man:sh[1] não tem acesso aos parâmetros "
"posicionais de quem a chamou, mas o man:rc.subr[8] é apenas um conjunto "
"dessas funções. Em segundo lugar, a boa prática do [.filename]#rc.d# dita "
"que é responsabilidade do script principal decidir quais argumentos devem "
"ser passados para seus métodos."

#. type: Plain text
#: documentation/content/en/articles/rc-scripting/_index.adoc:745
msgid ""
"So the approach adopted by man:rc.subr[8] is as follows: `run_rc_command` "
"passes on all its arguments but the first one to the respective method "
"verbatim.  The first, omitted, argument is the name of the method itself: "
"`start`, `stop`, etc.  It will be shifted out by `run_rc_command`, so what "
"is `$2` in the original command line will be presented as `$1` to the "
"method, and so on."
msgstr ""
"Portanto, a abordagem adotada pelo man:rc.subr[8] é a seguinte: "
"`run_rc_command` passa todos os seus argumentos, exceto o primeiro, ao "
"respectivo método sem alterações. O primeiro argumento omitido é o nome do "
"método em si: `start`, `stop`, etc. Ele será removido por `run_rc_command`, "
"então o que é `$2` na linha de comando original será apresentado como `$1` "
"para o método, e assim por diante."

#. type: Plain text
#: documentation/content/en/articles/rc-scripting/_index.adoc:748
msgid ""
"To illustrate this opportunity, let us modify the primitive dummy script so "
"that its messages depend on the additional arguments supplied.  Here we go:"
msgstr ""
"Para ilustrar essa oportunidade, vamos modificar o script fictício primitivo "
"para que suas mensagens dependam dos argumentos adicionais fornecidos. Aqui "
"vamos nós:"

#. type: delimited block . 4
#: documentation/content/en/articles/rc-scripting/_index.adoc:760
#, no-wrap
msgid ""
"name=\"dummy\"\n"
"start_cmd=\"${name}_start\"\n"
"stop_cmd=\":\"\n"
"kiss_cmd=\"${name}_kiss\"\n"
"extra_commands=\"kiss\"\n"
msgstr ""
"name=\"dummy\"\n"
"start_cmd=\"${name}_start\"\n"
"stop_cmd=\":\"\n"
"kiss_cmd=\"${name}_kiss\"\n"
"extra_commands=\"kiss\"\n"

#. type: delimited block . 4
#: documentation/content/en/articles/rc-scripting/_index.adoc:769
#, no-wrap
msgid ""
"dummy_start()\n"
"{\n"
"        if [ $# -gt 0 ]; then <.>\n"
"                echo \"Greeting message: $*\"\n"
"        else\n"
"                echo \"Nothing started.\"\n"
"        fi\n"
"}\n"
msgstr ""
"dummy_start()\n"
"{\n"
"        if [ $# -gt 0 ]; then <.>\n"
"                echo \"Greeting message: $*\"\n"
"        else\n"
"                echo \"Nothing started.\"\n"
"        fi\n"
"}\n"

#. type: delimited block . 4
#: documentation/content/en/articles/rc-scripting/_index.adoc:785
#, no-wrap
msgid ""
"dummy_kiss()\n"
"{\n"
"        echo -n \"A ghost gives you a kiss\"\n"
"        if [ $# -gt 0 ]; then <.>\n"
"                echo -n \" and whispers: $*\"\n"
"        fi\n"
"        case \"$*\" in\n"
"        *[.!?])\n"
"                echo\n"
"                ;;\n"
"        *)\n"
"                echo .\n"
"                ;;\n"
"        esac\n"
"}\n"
msgstr ""
"dummy_kiss()\n"
"{\n"
"        echo -n \"A ghost gives you a kiss\"\n"
"        if [ $# -gt 0 ]; then <.>\n"
"                echo -n \" and whispers: $*\"\n"
"        fi\n"
"        case \"$*\" in\n"
"        *[.!?])\n"
"                echo\n"
"                ;;\n"
"        *)\n"
"                echo .\n"
"                ;;\n"
"        esac\n"
"}\n"

#. type: delimited block . 4
#: documentation/content/en/articles/rc-scripting/_index.adoc:788
#, no-wrap
msgid ""
"load_rc_config $name\n"
"run_rc_command \"$@\" <.>\n"
msgstr ""
"load_rc_config $name\n"
"run_rc_command \"$@\" <.>\n"

#. type: Plain text
#: documentation/content/en/articles/rc-scripting/_index.adoc:791
msgid "What essential changes can we notice in the script?"
msgstr "Quais mudanças essenciais podemos notar no script?"

#. type: Plain text
#: documentation/content/en/articles/rc-scripting/_index.adoc:796
msgid ""
"&#10122; All arguments you type after `start` can end up as positional "
"parameters to the respective method.  We can use them in any way according "
"to our task, skills, and fancy.  In the current example, we just pass all of "
"them to man:echo[1] as one string in the next line - note `$*` within the "
"double quotes.  Here is how the script can be invoked now:"
msgstr ""
"&#10122; Todos os argumentos que você digita após `start` podem acabar como "
"parâmetros posicionais para o respectivo método. Podemos usá-los de qualquer "
"maneira de acordo com nossa tarefa, habilidades e gosto. No exemplo atual, "
"simplesmente passamos todos eles para o man:echo[1] como uma única string na "
"próxima linha - observe o `$*` dentro das aspas duplas. Aqui está como o "
"script pode ser invocado agora:"

#. type: delimited block . 4
#: documentation/content/en/articles/rc-scripting/_index.adoc:801
#, no-wrap
msgid ""
"# /etc/rc.d/dummy start\n"
"Nothing started.\n"
msgstr ""
"# /etc/rc.d/dummy start\n"
"Nothing started.\n"

#. type: delimited block . 4
#: documentation/content/en/articles/rc-scripting/_index.adoc:804
#, no-wrap
msgid ""
"# /etc/rc.d/dummy start Hello world!\n"
"Greeting message: Hello world!\n"
msgstr ""
"# /etc/rc.d/dummy start Hello world!\n"
"Greeting message: Hello world!\n"

#. type: Plain text
#: documentation/content/en/articles/rc-scripting/_index.adoc:808
msgid ""
"&#10123; The same applies to any method our script provides, not only to a "
"standard one.  We have added a custom method named `kiss`, and it can take "
"advantage of the extra arguments not less than `start` does. E.g.:"
msgstr ""
"&#10123; O mesmo se aplica a qualquer método que nosso script ofereça, não "
"apenas a um padrão. Adicionamos um método personalizado chamado `kiss`, e "
"ele pode tirar proveito dos argumentos extras da mesma forma que o `start` "
"pode. Por exemplo:"

#. type: delimited block . 4
#: documentation/content/en/articles/rc-scripting/_index.adoc:813
#, no-wrap
msgid ""
"# /etc/rc.d/dummy kiss\n"
"A ghost gives you a kiss.\n"
msgstr ""
"# /etc/rc.d/dummy kiss\n"
"A ghost gives you a kiss.\n"

#. type: delimited block . 4
#: documentation/content/en/articles/rc-scripting/_index.adoc:816
#, no-wrap
msgid ""
"# /etc/rc.d/dummy kiss Once I was Etaoin Shrdlu...\n"
"A ghost gives you a kiss and whispers: Once I was Etaoin Shrdlu...\n"
msgstr ""
"# /etc/rc.d/dummy kiss Once I was Etaoin Shrdlu...\n"
"A ghost gives you a kiss and whispers: Once I was Etaoin Shrdlu...\n"

#. type: Plain text
#: documentation/content/en/articles/rc-scripting/_index.adoc:819
msgid ""
"&#10124; If we want just to pass all extra arguments to any method, we can "
"merely substitute `\"$@\"` for `\"$1\"` in the last line of our script, "
"where we invoke `run_rc_command`."
msgstr ""
"&#10124; Se quisermos apenas passar todos os argumentos extras para qualquer "
"método, podemos simplesmente substituir `\"$1\"` por `\"$@\"` na última "
"linha do nosso script, onde invocamos `run_rc_command`."

#. type: delimited block = 4
#: documentation/content/en/articles/rc-scripting/_index.adoc:825
msgid ""
"An man:sh[1] programmer ought to understand the subtle difference between `"
"$*` and `$@` as the ways to designate all positional parameters.  For its in-"
"depth discussion, refer to a good handbook on man:sh[1] scripting.  _Do not_ "
"use the expressions until you fully understand them because their misuse "
"will result in buggy and insecure scripts."
msgstr ""
"Um programador em man:sh[1] deve entender a diferença sutil entre `$*` e `$@`"
" como formas de designar todos os parâmetros posicionais. Para uma discussão "
"aprofundada, consulte um bom manual de man:sh[1]. Não use essas expressões "
"até entender completamente o seu uso, pois o uso incorreto pode resultar em "
"scripts com bugs e inseguros."

#. type: delimited block = 4
#: documentation/content/en/articles/rc-scripting/_index.adoc:832
msgid ""
"Currently `run_rc_command` may have a bug that prevents it from keeping the "
"original boundaries between arguments.  That is, arguments with embedded "
"whitespace may not be processed correctly.  The bug stems from `$*` misuse."
msgstr ""
"Atualmente, o `run_rc_command` pode ter um bug que o impede de manter as "
"fronteiras originais entre os argumentos. Ou seja, argumentos com espaços em "
"branco embutidos podem não ser processados corretamente. O bug decorre do "
"uso inadequado de `$*`."

#. type: Title ==
#: documentation/content/en/articles/rc-scripting/_index.adoc:835
#, no-wrap
msgid "Further reading"
msgstr "Leitura adicional"

#. type: Plain text
#: documentation/content/en/articles/rc-scripting/_index.adoc:839
msgid ""
"[[lukem]]http://www.mewburn.net/luke/papers/rc.d.pdf[The original article by "
"Luke Mewburn] offers a general overview of [.filename]#rc.d# and detailed "
"rationale for its design decisions.  It provides insight on the whole [."
"filename]#rc.d# framework and its place in a modern BSD operating system."
msgstr ""
"[[lukem]]http://www.mewburn.net/luke/papers/rc.d.pdf[O artigo original de "
"Luke Mewburn] oferece uma visão geral do [.filename]#rc.d# e uma "
"justificativa detalhada para suas decisões de design. Ele fornece uma "
"compreensão do quadro geral do [.filename]#rc.d# e seu lugar em um sistema "
"operacional BSD moderno."

#. type: Plain text
#: documentation/content/en/articles/rc-scripting/_index.adoc:842
msgid ""
"[[manpages]]The manual pages man:rc[8], man:rc.subr[8], and man:rcorder[8] "
"document the [.filename]#rc.d# components in great detail.  You cannot fully "
"use the [.filename]#rc.d# power without studying the manual pages and "
"referring to them while writing your own scripts."
msgstr ""
"[[manpages]]As páginas do manual para man:rc[8], man:rc.subr[8] e "
"man:rcorder[8] documentam em detalhes os componentes do sistema [."
"filename]#rc.d#. Você não pode aproveitar completamente o poder do [."
"filename]#rc.d# sem estudar as páginas do manual e consultá-las ao escrever "
"seus próprios scripts."

#. type: Plain text
#: documentation/content/en/articles/rc-scripting/_index.adoc:846
msgid ""
"The major source of working, real-life examples is [.filename]#/etc/rc.d# in "
"a live system.  Its contents are easy and pleasant to read because most "
"rough corners are hidden deep in man:rc.subr[8].  Keep in mind though that "
"the [.filename]#/etc/rc.d# scripts were not written by angels, so they might "
"suffer from bugs and suboptimal design decisions.  Now you can improve them!"
msgstr ""
"A principal fonte de exemplos práticos e funcionais é o diretório [."
"filename]#/etc/rc.d# em um sistema em operação. O seu conteúdo é fácil e "
"agradável de ler, pois a maioria das partes difíceis está escondida "
"profundamente em man:rc.subr[8]. No entanto, tenha em mente que os scripts "
"em [.filename]#/etc/rc.d# não foram escritos por anjos, então eles podem "
"conter bugs e decisões de design subótimas. Agora você pode melhorá-los!"

#~ msgid ""
#~ "include::shared/attributes/attributes-{{% lang %}}.adoc[] include::shared/"
#~ "{{% lang %}}/teams.adoc[] include::shared/{{% lang %}}/mailing-lists."
#~ "adoc[] include::shared/{{% lang %}}/urls.adoc[]"
#~ msgstr ""
#~ "include::shared/attributes/attributes-{{% lang %}}.adoc[] include::shared/"
#~ "{{% lang %}}/teams.adoc[] include::shared/{{% lang %}}/mailing-lists."
#~ "adoc[] include::shared/{{% lang %}}/urls.adoc[]"