Projet

Général

Profil

Télécharger (1,88 ko) Statistiques
| Branche: | Tag: | Révision:

univnautes / etc / rc.notify_message @ master

1
#!/usr/local/bin/php
2
<?php
3
/*
4
    rc.notify_message
5
    part of pfSense (https://www.pfsense.org)
6
    Copyright (C) 2010 Scott Ullrich <sullrich@gmail.com>
7
    All rights reserved.
8

    
9
    Redistribution and use in source and binary forms, with or without
10
    modification, are permitted provided that the following conditions are met:
11

    
12
    1. Redistributions of source code must retain the above copyright notice,
13
       this list of conditions and the following disclaimer.
14

    
15
    2. Redistributions in binary form must reproduce the above copyright
16
       notice, this list of conditions and the following disclaimer in the
17
       documentation and/or other materials provided with the distribution.
18

    
19
    THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
20
    INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
21
    AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
22
    AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
23
    OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24
    SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25
    INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26
    CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27
    ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28
    POSSIBILITY OF SUCH DAMAGE.
29
*/
30

    
31
require_once("config.inc");
32
require_once("functions.inc");
33
require_once("notices.inc");
34

    
35
$arguments = getopt("egm:");
36

    
37
$send_email = false;
38
$send_growl = false;
39
$message = "";
40

    
41
foreach($arguments as $item => $arg) {
42
	switch($item) {
43
		case "e":
44
			$send_email = true;
45
			break;
46
		case "g":
47
			$send_growl = true;
48
			break;
49
		case "m":
50
			$message = $arg;
51
			break;
52
	}
53
}
54

    
55
if($message) {
56
	if($send_email) {
57
		notify_via_smtp($message);
58
	}
59
	if($send_growl) {
60
		notify_via_growl($message);
61
	}
62
}
63

    
64
?>
(76-76/103)