-
Notifications
You must be signed in to change notification settings - Fork 0
/
psServ
36 lines (25 loc) · 823 Bytes
/
psServ
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/bash
# SCRIPT TEM COMO FINALIDADE MONITORAR A ATIVIDADE DE ALGUM SERVIÇO SELECIONADO PELO USUÁRIO.
## A SAÍDA DA VERIFICAÇÃO SERÁ ARMAZENADA EM UMA PASTA NO /home/"Nome do usuário"/"NomeDoServico"log,
## O ARQUIVO SERA NOMEADO COM A DATA A QUAL O SCRIPT FOI EXECUTADO.
# WRITTEN BY <cdomingues@conecto.com.br> in august 2022
# By Charlie Augusto
echo
echo "Nome do Serviço: "
read serv
echo
echo "VERIFICACAO ${serv^^}" ## ^^ deixa texto em maiusculo
echo
inpt=$(ps -ef | grep $serv)
arq=$(date +%F)
creat=$(mkdir /home/$USER/$serv"log"/)
for ((loop=1;loop>0;loop++));do
echo
echo "-------------------------------------------------------------------------------------------"
echo
sleep 1800
echo -e "Verificacao de numero $loop"
echo
echo $inpt
echo $inpt >> /home/$USER/$serv"log"/${arq}
done