Menu para liberar / bloquear laboratórios no Squid

Publicado por Diego Henrique Pereira 23/11/2006

[ Hits: 5.729 ]

Download internet




Como já citei antes, trabalho em uma faculdade e há a necessidade de liberar ou bloquear laboratórios conforme o professor. Para isso criei esse script que gera um menu para liberar ou bloquear conforme sua necessidade.

Note que para cada opção será necessário criar um squid.conf com as configurações necessárias.

  



Esconder código-fonte

#!/bin/bash

$cont1 > "1"
$cont2 > "1"
clear

while [$cont1 = $cont2]; do 

echo -e "O que deseja fazer?"
echo -e "<1> - Bloquear todos os Laboratórios"
echo -e "<2> - Liberar todos os Laboratórios"
echo -e "<3> - Liberar o Laboratório 1"
echo -e "<4> - Liberar o Laboratório 2"
echo -e "<5> - Liberar o Laboratório 3"
echo -e "<6> - Liberar os Laboratórios 1 e 2"
echo -e "<7> - Liberar os Laboratórios 1 e 3"
echo -e "<8> - Liberar os Laboratórios 2 e 3"
echo -e "Qual sua opção? "
read opcao
case "$opcao"
   in
   1)   /usr/sbin/squid -k kill
      /usr/sbin/squid -f /usr/local/squid/etc/labblock/squid.conf
      clear
      echo "******************************************"
                echo "*                                        *"
                echo "*                                        *"
                echo "*                                        *"
    echo -e '\E[04;32m* Todos os Laboratórios estão BLOQUEADOS *'; tput sgr0
      echo "*                                        *"
                echo "*                                        *"
                echo "*                                        *"
                echo "******************************************"
   ;;
   2)   /usr/sbin/squid -k kill
      /usr/sbin/squid -f /usr/local/squid/etc/lablib/squid.conf
      clear
      echo "******************************************"
      echo "*                                        *"
      echo "*                                        *"
      echo "*                                        *"
    echo -e '\E[04;32m* Todos os Laboratórios estão LIBERADOS  *'; tput sgr0
      echo "*                                        *"
      echo "*                                        *"
      echo "*                                        *"
      echo "******************************************" 
   ;;
   3)   /usr/sbin/squid -k kill
      /usr/sbin/squid -f /usr/local/squid/etc/lab1/squid.conf
      clear
      echo "******************************************"
                echo "*                                        *"
                echo "*                                        *"    
                echo "*                                        *"
    echo -e '\E[04;32m*         LABORATÓRIO 1 LIBERADO         *'; tput sgr0
      echo "*                                        *"
                echo "*                                        *"
                echo "*                                        *"
                echo "******************************************"
   ;;
   4)   /usr/sbin/squid -k kill
      /usr/sbin/squid -f /usr/local/squid/etc/lab2/squid.conf
      clear
      echo "******************************************"
                echo "*                                        *"
                echo "*                                        *"
                echo "*                                        *"
    echo -e '\E[04;32m*         LABORATÓRIO 2 LIBERADO         *'; tput sgr0
      echo "*                                        *"
                echo "*                                        *"
                echo "*                                        *"
                echo "******************************************"
   ;;
   5)   /usr/sbin/squid -k kill
      /usr/sbin/squid -f /usr/local/squid/etc/lab3/squid.conf
      clear
      echo "******************************************"
                echo "*                                        *"
                echo "*                                        *"
                echo "*                                        *"
    echo -e '\E[04;32m*         LABORATÓRIO 3 LIBERADO         *'; tput sgr0
      echo "*                                        *"
                echo "*                                        *"
                echo "*                                        *"
                echo "******************************************"
   ;;
   6)   /usr/sbin/squid -k kill
      /usr/sbin/squid -f /usr/local/squid/etc/lab12/squid.conf
      clear
      echo "******************************************"
                echo "*                                        *"
                echo "*                                        *"
                echo "*                                        *"
    echo -e '\E[04;32m*      LABORATÓRIOS 1 E 2  LIBERADOS     *'; tput sgr0
      echo "*                                        *"
                echo "*                                        *"
                echo "*                                        *"
                echo "******************************************"
   ;;
   7)   /usr/sbin/squid -k kill
      /usr/sbin/squid -f /usr/local/squid/etc/lab13/squid.conf
      clear
      echo "******************************************"
                echo "*                                        *"
                echo "*                                        *"
                echo "*                                        *"
    echo -e '\E[04;32m*      LABORATÓRIOS 1 E 3  LIBERADOS     *'; tput sgr0
      echo "*                                        *"
                echo "*                                        *"
                echo "*                                        *"
                echo "******************************************"
   ;;
   8)   /usr/sbin/squid -k kill
      /usr/sbin/squid -f /usr/local/squid/etc/lab23/squid.conf
      clear
      echo "******************************************"
                echo "*                                        *"
                echo "*                                        *"
                echo "*                                        *"
    echo -e '\E[04;32m*      LABORATÓRIOS 2 E 3  LIBERADOS     *'; tput sgr0
      echo "*                                        *"
                echo "*                                        *"
                echo "*                                        *"
                echo "******************************************"
   ;;
esac
done

Scripts recomendados

SonyEricson-MD300 funciona

Compilar latex e gerar pdf

Compilação do QMPlay2 no Deepin 20

DefaultApps

Ano bissexto


  

Comentários
[1] Comentário enviado por hatin em 23/11/2006 - 14:25h

o q as linhas

$cont1 > "1"
$cont2 > "1"

faz ?

[2] Comentário enviado por edisonsousa em 24/11/2006 - 09:58h

legal esse script, vou colocar para funcionar !!!


Contribuir com comentário




Patrocínio

Site hospedado pelo provedor RedeHost.
Linux banner

Destaques

Artigos

Dicas

Tópicos

Top 10 do mês

Scripts