SLAC - Programa de manutenção para Slackware 14x
Publicado por Slackjeff (última atualização em 26/03/2018)
[ Hits: 2.509 ]
Homepage: https://slackjeff.com.br
Programa de manutenção para Slackware 14x.
#!/usr/bin/env bash #-------HEADER---------------------------------------------------------------------| #AUTOR # Jefferson Rocha <lrcjefferson@gmail.com> # #PROGRAMA # Slac # #DESCRICAO # Programa de manutenção para Slackware 14x # #DEPENDÊNCIAS # ntpd >= 4.2.8 # bash >= 4.4.12 # #CHANGELOG # 23/02/2018 (Jefferson Rocha) # -Adicionado Chaves, (internet_key e keyboard_key) # para ativação dos serviços desejados # # -Agora podemos atualizar a hora! # # -Opções podem ser chamadas via linha de comando. # (-i ou --internet, -k ou --keyboard, -h ou --hour, -H ou --help) # #----------------------------------------------------------------------------------| ########################################## # # # Controle de chave. # # Caso queira habilitar/desabilitar # # algum recurso do programa # # # # 0 Para desligado, 1 para ligado # # # ########################################## internet_key="0" # Internet keyboard_key="1" # Teclado hour_key="0" # Hora #################################################### # # # Mude conforme sua necessidade... # # Para verificar qual sua interface use o comando # # "ifconfig -s" # # Por exemplo, para conexões com placa wireless a # # interface pode ser wlan0, wlan1 wlan2 etc... # # Para conexções Cabeadas eth0, eth1, enps0 etc... # # # # Por padrão o programa slac vem interface eth0 # # # #################################################### interface="eth0" ### FIM DA CONFIGURAÇÃO, não edite daqui para baixo. #-----VÁRIAVEIS-------------------> VERSION="1.0" # Servidores para o uso do ntpdate server1="ntp.br" server2="2.br.pool.ntp.org" # Cores para vida end="\033[m" red="\033[31;1m" green="\033[38;1m" #---------------------------------> #--------FUNÇÕES------------------> have_internet(){ wget -q --spider www.google.com; } help_now(){ cat << EOF | less NOME Slac - Sistema de configuração do Slackware VERSAO $VERSION SINOPSE slac [PARÂMETRO] [OPERAÇÃO] OPÇÕES -i, --internet Ative a configuração da internet... A interface padrão é eth0, caso deseje mudar use -i [INTERFACE] -k, --keyboard Troque a configuração do teclado para ABNT2 -h, --hour Ajuste a hora do sistema com ntpdate... -H, --help Chama este manual AUTOR Escrito por Jefferson Rocha <lrcjefferson@gmail.com> LICENÇA MIT PRESSIONE 'Q' para SAIR EOF } #---------------------------------> #-----TESTES INICIAIS-------------> [[ "$UID" -ne "0" ]] && exit 1 # Ntpdate não existe? chave desliga. [[ $(which ntpdate 2>/dev/null) ]] && hour_key="0" #---------------------------------> ################################# # Opções via linha de comando # # Parâmetro foi utilizado? # # A chave é ligada! # ################################# while [[ -n "$1" ]]; do case "$1" in -i|--internet) internet_key="1" shift interface="$1" [[ -z "$1" ]] && interface="eth0" ;; -k|--keyboard) keyboard_key="1" && shift ;; -h|--hour) hour_key="1" && shift ;; -H|--help) help_now && shift;; # Chamada Função esac done # Aqui toda brincadeira começa! # boa diversão! # Internet if [[ "$internet_key" = "1" ]]; then # Chave está habilitada? if ! have_internet; then if ! which dhclient >/dev/null 2>&1; then dhcpcd -t 5 "$interface" else dhclient "$interface" fi fi fi # Teclado if [[ "$keyboard_key" = "1" ]]; then # Chave está habilitada? if [[ "$TERM" != "linux" ]]; then setxkbmap -model abnt2 -layout br else loadkeys br-abnt2 fi fi # Hora if [[ "$hour_key" = "1" ]]; then if ! have_internet; then if ! ntpdate "$server1"; then ntpdate "$server2" fi fi fi
Administração básica de usuários no MySQL
Bloquear Whatsapp, Facebook, Youtube e outros pelo IPTABLES
Nenhum coment�rio foi encontrado.
Servidor de Backup com Ubuntu Server 24.04 LTS, RAID e Duplicati (Dell PowerEdge T420)
Visualizar câmeras IP ONVIF no Linux sem necessidade de instalar aplicativos
Atualizar Debian Online de uma Versão para outra
Instalar driver Nvidia no Debian 13
Redimensionando, espelhando, convertendo e rotacionando imagens com script
Debian 13 Trixie para Iniciantes
Convertendo pacotes DEB que usam ZSTD (Padrão Novo) para XZ (Padrão Antigo)
baschrc customizado pegeui vários. (3)
Rust é o "C da nossa geração"? (8)