Created
September 16, 2025 15:25
-
-
Save shadyueh/692ef5adcbbf31db70ef24637aa79e80 to your computer and use it in GitHub Desktop.
Configura impressora no Ubuntu
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| set -e | |
| # ============================================== | |
| # Script para configurar Epson WF-M5799 no Ubuntu | |
| # - Remove impressoras antigas | |
| # - Desativa cups-browsed (descoberta automática) | |
| # - Adiciona impressora via IPP Everywhere | |
| # - Define como padrão | |
| # - Testa impressão | |
| # ============================================== | |
| PRINTER_NAME="EpsonWFM5799" | |
| PRINTER_IP="$1" | |
| if [[ -z "$PRINTER_IP" ]]; then | |
| echo "❌ Erro: informe o IP da impressora." | |
| echo "Uso: $0 192.168.1.50" | |
| exit 1 | |
| fi | |
| echo "🔎 Removendo impressoras existentes..." | |
| lpstat -p | awk '{print $2}' | while read -r printer; do | |
| sudo lpadmin -x "$printer" || true | |
| done | |
| echo "🛑 Desativando cups-browsed..." | |
| sudo systemctl stop cups-browsed || true | |
| sudo systemctl disable cups-browsed || true | |
| echo "🖨️ Adicionando impressora $PRINTER_NAME ($PRINTER_IP)..." | |
| sudo lpadmin -p "$PRINTER_NAME" \ | |
| -E \ | |
| -v "ipp://$PRINTER_IP/ipp/print" \ | |
| -m everywhere | |
| echo "⭐ Definindo como impressora padrão..." | |
| sudo lpoptions -d "$PRINTER_NAME" | |
| echo "📝 Testando impressão..." | |
| echo "Teste de Impressão na $PRINTER_NAME" | lp | |
| echo "✅ Concluído! Impressora $PRINTER_NAME configurada com sucesso." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment