File tree 5 files changed +56
-1
lines changed
5 files changed +56
-1
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,17 @@ fn_alert_log() {
27
27
} | sed -r " s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g" | tee -a " ${alertlog} " > /dev/null 2>&1
28
28
}
29
29
30
+ fn_alert_custom () {
31
+ fn_script_log_info " Sending custom alert: Custom alert from ${selfname} ."
32
+ alertaction=" ${customalerttitle} "
33
+ alertemoji=" 📢"
34
+ alertsound=" 1"
35
+ alertmessage=" ${customalertmessage} "
36
+ # Green
37
+ alertcolourhex=" #6600CC"
38
+ alertcolourdec=" 6684876"
39
+ }
40
+
30
41
fn_alert_test () {
31
42
fn_script_log_info " Sending alert: Testing LinuxGSM Alert. No action to be taken"
32
43
alertaction=" Tested"
@@ -206,6 +217,8 @@ elif [ "${alert}" == "monitor-session" ]; then
206
217
fn_alert_monitor_session
207
218
elif [ " ${alert} " == " monitor-query" ]; then
208
219
fn_alert_monitor_query
220
+ elif [ " ${alert} " == " custom" ]; then
221
+ fn_alert_custom
209
222
elif [ " ${alert} " == " test" ]; then
210
223
fn_alert_test
211
224
elif [ " ${alert} " == " update" ]; then
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+ # LinuxGSM command_custom_alert.sh module
3
+ # Author: Daniel Gibbs
4
+ # Contributors: http://linuxgsm.com/contrib
5
+ # Website: https://linuxgsm.com
6
+ # Description: Sends a custom alert.
7
+
8
+ commandname=" CUSTOM-ALERT"
9
+ commandaction=" Custom Alert"
10
+ moduleselfname=" $( basename " $( readlink -f " ${BASH_SOURCE[0]} " ) " ) "
11
+ fn_firstcommand_set
12
+
13
+ check.sh
14
+
15
+ if [ -n " ${userinput2} " ]; then
16
+ customalertmessage=" ${userinput2} "
17
+ else
18
+ fn_print_header
19
+ fn_print_information_nl " Send a custom alert."
20
+ echo " "
21
+ customalertmessage=$( fn_prompt_message " alert message: " )
22
+ fi
23
+
24
+ # optional: custom alert title
25
+ if [ -n " ${userinput3} " ]; then
26
+ customalerttitle=" ${userinput3} "
27
+ else
28
+ customalerttitle=" Custom Alert"
29
+ fi
30
+
31
+ info_game.sh
32
+ alert=" custom"
33
+ alert.sh
34
+
35
+ core_exit.sh
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ cmd_details=("dt;details" "command_details.sh" "Display server information.")
19
19
cmd_postdetails=(" pd;postdetails" " command_postdetails.sh" " Post details to termbin.com (removing passwords)." )
20
20
cmd_backup=(" b;backup" " command_backup.sh" " Create backup archives of the server." )
21
21
cmd_update_linuxgsm=(" ul;update-lgsm;uf;update-modules" " command_update_linuxgsm.sh" " Check and apply any LinuxGSM updates." )
22
+ cmd_custom_alert=(" ca;custom-alert" " command_custom_alert.sh" " Send a customizable alert." )
22
23
cmd_test_alert=(" ta;test-alert" " command_test_alert.sh" " Send a test alert." )
23
24
cmd_monitor=(" m;monitor" " command_monitor.sh" " Check server status and restart if crashed." )
24
25
cmd_skeleton=(" sk;skeleton" " command_skeleton.sh" " Create a skeleton directory." )
@@ -60,7 +61,7 @@ cmd_dev_clear_modules=("cm;clear-modules" "command_dev_clear_modules.sh" "Delete
60
61
61
62
# ## Set specific opt here.
62
63
63
- currentopt=(" ${cmd_start[@]} " " ${cmd_stop[@]} " " ${cmd_restart[@]} " " ${cmd_monitor[@]} " " ${cmd_test_alert[@]} " " ${cmd_details[@]} " " ${cmd_postdetails[@]} " " ${cmd_skeleton[@]} " )
64
+ currentopt=(" ${cmd_start[@]} " " ${cmd_stop[@]} " " ${cmd_restart[@]} " " ${cmd_monitor[@]} " " ${cmd_custom_alert[@]} " " ${ cmd_test_alert[@]}" " ${cmd_details[@]} " " ${cmd_postdetails[@]} " " ${cmd_skeleton[@]} " )
64
65
65
66
# Update LinuxGSM.
66
67
currentopt+=(" ${cmd_update_linuxgsm[@]} " )
Original file line number Diff line number Diff line change @@ -96,6 +96,11 @@ command_postdetails.sh() {
96
96
fn_fetch_module
97
97
}
98
98
99
+ command_custom_alert.sh () {
100
+ modulefile=" ${FUNCNAME[0]} "
101
+ fn_fetch_module
102
+ }
103
+
99
104
command_test_alert.sh () {
100
105
modulefile=" ${FUNCNAME[0]} "
101
106
fn_fetch_module
Original file line number Diff line number Diff line change @@ -48,6 +48,7 @@ configdirserver="${configdir}/${gameservername}"
48
48
configdirdefault=" ${lgsmdir} /config-default"
49
49
userinput=" ${1} "
50
50
userinput2=" ${2} "
51
+ userinput3=" ${3} "
51
52
52
53
# # GitHub Branch Select
53
54
# Allows for the use of different function files
You can’t perform that action at this time.
0 commit comments