-
Notifications
You must be signed in to change notification settings - Fork 0
/
automatic_backup.php
executable file
·61 lines (58 loc) · 3.03 KB
/
automatic_backup.php
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
#!/usr/bin/php
<?php
/**
vim: set expandtab tabstop=4 softtabstop=4 shiftwidth=4:
Codificación: UTF-8
+----------------------------------------------------------------------+
| Elastix version 2.0 |
| http://www.elastix.org |
+----------------------------------------------------------------------+
| Copyright (c) 2006 Palosanto Solutions S. A. |
+----------------------------------------------------------------------+
| Cdla. Nueva Kennedy Calle E 222 y 9na. Este |
| Telfs. 2283-268, 2294-440, 2284-356 |
| Guayaquil - Ecuador |
| http://www.palosanto.com |
+----------------------------------------------------------------------+
| The contents of this file are subject to the General Public License |
| (GPL) Version 2 (the "License"); you may not use this file except in |
| compliance with the License. You may obtain a copy of the License at |
| http://www.opensource.org/licenses/gpl-license.php |
| |
| Software distributed under the License is distributed on an "AS IS" |
| basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See |
| the License for the specific language governing rights and |
| limitations under the License. |
+----------------------------------------------------------------------+
| The Original Code is: Elastix Open Source. |
| The Initial Developer of the Original Code is PaloSanto Solutions |
+----------------------------------------------------------------------+
$Id: dhcpconfig.php,v 1.1 2007/01/09 23:49:36 alex Exp $
**/
load_default_timezone();
// All of the following assumes this script runs as root
$sBackupFilename = 'elastixbackup-'.date('YmdHis').'-ab.tar';
// Change the following path to your own backup dir
$sBackupDir = '/path/to/backup/dir';
$retval = null;
// Specify a list of components that will be backup, otherwise "all" as the default
$sComponents=array('endpoint','as_db','as_config_files','as_sounds','as_mohmp3','as_dahdi');
system('/path/to/backupengine --backup --components '.implode(",", $sComponents).' --backupfile '.$sBackupFilename.' --tmpdir '.$sBackupDir, $retval);
exit($retval);
function load_default_timezone()
{
$sDefaultTimezone = @date_default_timezone_get();
if ($sDefaultTimezone == 'UTC') {
$sDefaultTimezone = 'America/New_York';
if (file_exists('/etc/sysconfig/clock')) {
foreach (file('/etc/sysconfig/clock') as $s) {
$regs = null;
if (preg_match('/^ZONE\s*=\s*"(.+)"/', $s, $regs)) {
$sDefaultTimezone = $regs[1];
}
}
}
}
date_default_timezone_set($sDefaultTimezone);
}
?>