1
|
#!/usr/local/bin/php
|
2
|
<?php
|
3
|
/*
|
4
|
* rc.notify_message
|
5
|
*
|
6
|
* part of pfSense (https://www.pfsense.org)
|
7
|
* Copyright (c) 2010-2018 Rubicon Communications, LLC (Netgate)
|
8
|
* All rights reserved.
|
9
|
*
|
10
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
11
|
* you may not use this file except in compliance with the License.
|
12
|
* You may obtain a copy of the License at
|
13
|
*
|
14
|
* http://www.apache.org/licenses/LICENSE-2.0
|
15
|
*
|
16
|
* Unless required by applicable law or agreed to in writing, software
|
17
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
18
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
19
|
* See the License for the specific language governing permissions and
|
20
|
* limitations under the License.
|
21
|
*/
|
22
|
|
23
|
require_once("config.inc");
|
24
|
require_once("functions.inc");
|
25
|
require_once("notices.inc");
|
26
|
|
27
|
$arguments = getopt("egm:");
|
28
|
|
29
|
$send_email = false;
|
30
|
$send_growl = false;
|
31
|
$message = "";
|
32
|
|
33
|
foreach ($arguments as $item => $arg) {
|
34
|
switch ($item) {
|
35
|
case "e":
|
36
|
$send_email = true;
|
37
|
break;
|
38
|
case "g":
|
39
|
$send_growl = true;
|
40
|
break;
|
41
|
case "m":
|
42
|
$message = $arg;
|
43
|
break;
|
44
|
}
|
45
|
}
|
46
|
|
47
|
if ($message) {
|
48
|
if ($send_email) {
|
49
|
notify_via_smtp($message);
|
50
|
}
|
51
|
if ($send_growl) {
|
52
|
notify_via_growl($message);
|
53
|
}
|
54
|
}
|
55
|
|
56
|
?>
|