-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathstorage-inst.txt
104 lines (64 loc) · 2.52 KB
/
storage-inst.txt
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
read -e -p "
----------------------------------------
##### Low Storage Alert Installer #####
----------------------------------------
What percentage would you like to receive a LOW DISK Alert?
DEFAULT 90
What percentage?:" hd_warning_percent
: ${hd_warning_percent:=90}
echo "
Great Choice: $hd_warning_percent%"
read -e -p "
-------------------------------------------------------
What volume would you like HD Low alert for?
To find your /dev/ storage (mine is /dev/sda):
In terminal type:
lsblk -l
Enter for DEFAULT VALUE /dev/sda
You can re re-enter later in the installed script file:" hd_partition
: ${hd_partition:=/dev/sda}
echo "
Thank You!
I've stored: $hd_partition"
read -e -p "
-------------------------------------------------------
STORAGE WARNING Poll Rate...
This process will run from a SYSYTEMD Timer.
How often would you like this to be checked?
DEFAULT VALUE 6 hours.
You can re re-enter later in the script storage-warning.sh
How many hours?:" hd_poll_timing
: ${hd_poll_timing:=6}
echo "
Thank You!
I've stored: $hd_poll_timing hour/s
----------------------------------------
#### Installed service status below ####
----------------------------------------"
# Inserts choice hd warning storage-warning.sh
sed -i 's|"YOUR_HD_THRESHOLD"|'"$hd_warning_percent"'|g' storage-warning.sh
sed -i 's|"YOUR_HD_LOCATION"|'"$hd_partition"'|g' storage-warning.sh
# Insert your timings
sed -i 's|"YOUR_RESET_TIMING"|'"$hd_reset_timing"'|g' storage-warning.sh
sed -i 's|"YOUR_POLL_TIME"|'"$hd_poll_timing"'|g' storage-warning.timer
# Inserts chosen install directory into sytemd service
sed -i 's|"YOUR_INSTALL_DIR"|'"$inspath"'|g' storage-warn-tgm.service
sed -i 's|"YOUR_INSTALL_DIR"|'"$inspath"'|g' storage-warning.timer
### Move downloaded files to your chosen directory ##################
mv -i storage-warning.sh /$inspath
### Move Systemd files into system folder ##########################
mv -i storage-warn-tgm.service /etc/systemd/system/
mv -i storage-warning.timer /etc/systemd/system/
### Setting file permissions ########################################
chmod 700 /$inspath/storage-warning.sh
chmod 644 /etc/systemd/system/storage-warn-tgm.service
chmod 644 /etc/systemd/system/storage-warning.timer
# Setting Up SYSTEMD Job for hard disk alarm!
systemctl enable storage-warn-tgm.service
systemctl enable storage-warning.timer
# Reload systemd
systemctl daemon-reload
systemctl start storage-warn-tgm.service
systemctl start storage-warning.timer
# Status
systemctl status --no-pager storage-warning.timer