-
Notifications
You must be signed in to change notification settings - Fork 0
/
installer
executable file
·58 lines (55 loc) · 1.62 KB
/
installer
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/bash
#autor: root
#Fecha: Mon Apr 17 16:12:38 MDT 2017
#Comentario: Instalador del monitor
(( EUID != 0 )) && exec sudo -- "$0" "$@"
app_name="sysadmin-monitor"
folder="/etc/cron.$app_name"
clear
echo "Cual correo deseas usar para enviar avisos? "
read correo
echo "Cual es la contrasena? "
read correo_pass
echo "A cual correo deseas enviar los avisos? "
read correo_para
echo "Para hacer los respaldos en Dropbox se necesita un Access Token"
echo "Mas informacion: https://www.dropbox.com/developers/"
echo "Ingresa el Token de Acceso: "
read access_token
echo "Cada cuantos minutos deseas ejecutar la tarea?"
read minutes
salir="y"
mkdir $folder
rm $folder/krystal.conf 2> /dev/null
echo "ORDENADORES A MONITOREAR"
while [ "$salir" = "y" ]; do
echo "Ingresa la direccion IP: "
read ip
echo "Ingresa el usuario: "
read usuario
echo "Ingresa la contrasena del usuario: "
read contrasena
echo "$ip,$usuario,$contrasena" >> $folder/krystal.conf
echo "Desea agregar otro ordenador? (y)es/(n)o"
read -n1 salir
done
echo $correo_para >> $folder/krystal.conf
echo $access_token >> $folder/krystal.conf
cp mailconfig ~/.mailrc
echo "set smtp-auth-user=$correo" >> ~/.mailrc
echo "set smtp-auth-password=$correo_pass" >> ~/.mailrc
echo "set from=$correo" >> ~/.mailrc
mkdir ~/$app_name
cp ./krystal.sh $folder/krystal.sh && chmod +x $folder/krystal.sh
cp ./exp_copy_id $folder/exp_copy_id && chmod +x $folder/exp_copy_id
if [ -x $folder/krystal.sh ]; then
crontab - << EOF
$(crontab -l)
# sysadmin-monitor
*/$minutes * * * * $folder/krystal.sh >> ~/$app_name/output.log
# end sysadmin-monitor
EOF
fi
echo ""
echo "Instalación finalizada :)"
exit 0