-
Notifications
You must be signed in to change notification settings - Fork 0
/
Check-Fix-NIM-BKPS.sh
27 lines (27 loc) · 1.01 KB
/
Check-Fix-NIM-BKPS.sh
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
#!/bin/bash
hora=$(( 0 + $RANDOM % 9))
minutos=$(( $RANDOM % 5 + 0 ))
echo $hora
fecha=`date +%d``date +%m`
hostname=`uname -n`
hostname=${hostname:0:2}
echo "$hostname"
if [[ $hostname == g5 ]]
then
ls -la /usr/local/bin
cp /usr/local/bin/mksysbaz* /usr/local/bin/mksysbaz11
ls -la /usr/local/bin
cp /var/spool/cron/crontabs/root /var/spool/cron/crontabs/root_bkp_$fecha
echo "$minutos $hora * * 1 /usr/local/bin/mksysbaz11 2>&1 #Remove comment and define proper AZ name for the
script." >> /var/spool/cron/crontabs/root
./usr/local/bin/mksysbaz11 &
elif [[ $hostname == g4 ]]
then
ls -la /usr/local/bin
cp /usr/local/bin/mksysbaz* /usr/local/bin/mksysbaz1
ls -la /usr/local/bin
cp /var/spool/cron/crontabs/root /var/spool/cron/crontabs/root_bkp_$fecha
echo "$minutos $hora * * 1 /usr/local/bin/mksysbaz1 2>&1 #Remove comment and define proper AZ name for the
script." >> /var/spool/cron/crontabs/root
./usr/local/bin/mksysbaz1 &
fi