mysqlapache2combo - Pequeno script que facilita a vida
Publicado por Felipe Ruiz Peixoto (última atualização em 30/04/2015)
[ Hits: 4.652 ]
Homepage: https://www.ubuntu.com/
Quem trabalha com PHP e MySQL no Linux precisa ativar, reativar e desativar os serviços quando precisa no terminal. Eu fiz um pequeno script do shell que faz tudo automaticamente, só executar em um terminal. Não precisa executar como superusuário, ele vai pedir a senha pra você.
Aqui no meu Kali eu dou dois cliques no script e ele pergunta se eu quero executar, exibir etc. É uma mão na roda!
#!/bin/bash
#
# mysqlapache2combo
# Felipe Ruiz <feliperuiz.sax.eletronic@gmail.com>
function ask()
{
read answer
case "$answer" in
's' )
startAll;
;;
't' )
stopAll
;;
'r' )
restartAll
;;
*)
echo "Invalid option"
;;
esac
}
function startAll
{
service mysql start;
if [ $? -eq 0 ]
then
echo "mysql started."
fi
service apache2 start;
if [ $? -eq 0 ]
then
echo "apache2 started."
fi
}
function stopAll
{
service mysql stop;
if [ $? -eq 0 ]
then
echo "mysql stopped."
fi
service apache2 stop;
if [ $? -eq 0 ]
then
echo "apache2 stopped."
fi
}
function restartAll
{
service mysql stop;
if [ $? -eq 0 ]
then
echo "mysql stopped."
fi
service apache2 stop;
if [ $? -eq 0 ]
then
echo "apache2 stopped."
fi
sleep 1
service mysql start;
if [ $? -eq 0 ]
then
echo "mysql started."
fi
service apache2 start;
if [ $? -eq 0 ]
then
echo "apache2 started."
fi
}
if [ "`id -u`" -eq 0 ]
then
case "$1" in
start )
startAll
;;
stop )
stopAll
;;
restart )
restartAll
;;
* )
echo "Invalid option, press S to start, T to stop, R to restart:";
ask
;;
esac
else
echo "This script needs superuser permissions, please input your password:"
su -c "./mysqlapache2combo"
fi
Crie bash scripts "on-the-fly"
Autenticando no Velox Empresarial
arredonda - arredondando valores decimais quebrados
Script que converte maiúsculas em minúsculas e retira branco do nome.
Comparar 2 arquivos e mostrar os itens diferentes
Nenhum comentário foi encontrado.
IA Turbina o Desktop Linux enquanto distros renovam forças
Como extrair chaves TOTP 2FA a partir de QRCODE (Google Authenticator)
Linux em 2025: Segurança prática para o usuário
Desktop Linux em alta: novos apps, distros e privacidade marcam o sábado
IA chega ao desktop e impulsiona produtividade no mundo Linux
Atualizando o Fedora 42 para 43
Como saber se o seu e-mail já teve a senha vazada?
Como descobrir se a sua senha já foi vazada na internet?
Mint Xfce não mantém a conexão no wi-fi (2)
Problemas com Driver NVIDIA (5)
Warcraft II Remastered no Linux? (8)









