1 // distribution boxbackup-0.11_trunk_2979 (svn version: 2979)
2 // Box Backup, http://www.boxbackup.org/
3 //
4 // Copyright (c) 2003-2010, Ben Summers and contributors.
5 // All rights reserved.
6 //
7 // Note that this project uses mixed licensing. Any file with this license
8 // attached, or where the code LICENSE-GPL appears on the first line, falls
9 // under the "Box Backup GPL" license. See the file COPYING.txt for more
10 // information about this license.
11 //
12 // ---------------------------------------------------------------------
13 // This program is free software; you can redistribute it and/or
14 // modify it under the terms of the GNU General Public License
15 // as published by the Free Software Foundation; either version 2
16 // of the License, or (at your option) any later version.
17 //
18 // This program is distributed in the hope that it will be useful,
19 // but WITHOUT ANY WARRANTY; without even the implied warranty of
20 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21 // GNU General Public License for more details.
22 //
23 // You should have received a copy of the GNU General Public License
24 // along with this program; if not, write to the Free Software
25 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
26 //
27 // [http://www.gnu.org/licenses/old-licenses/gpl-2.0.html#SEC4]
28 //
29 // As a special exception to the GPLv2, the Box Backup Project gives
30 // permission to link any code falling under this license (the Box Backup
31 // GPL) with any software that can be downloaded from
32 // the OpenSSL website [http://www.openssl.org] under either the
33 // "OpenSSL License" or the "Original SSLeay License", and to distribute
34 // the linked executables under the terms of the "Box Backup GPL" license.
35 //
36 // As a special exception to the GPLv2, the Box Backup Project gives
37 // permission to link any code falling under this license (the Box Backup
38 // GPL) with any version of Microsoft's Volume Shadow Copy Service 7.2 SDK
39 // or Microsoft Windows Software Development Kit (SDK), including
40 // vssapi.lib, that can be downloaded from the Microsoft website
41 // [*.microsoft.com], and to distribute the linked executables under the
42 // terms of the "Box Backup GPL" license.
43 // --------------------------------------------------------------------------
44 //
45 // File
46 //		Name:    bbackupd.cpp
47 //		Purpose: main file for backup daemon
48 //		Created: 2003/10/11
49 //
50 // --------------------------------------------------------------------------
51 
52 #include "Box.h"
53 #include "BackupDaemon.h"
54 #include "MainHelper.h"
55 #include "BoxPortsAndFiles.h"
56 #include "BackupStoreException.h"
57 #include "Logging.h"
58 
59 #include "MemLeakFindOn.h"
60 
61 #ifdef WIN32
62 	#include "Win32ServiceFunctions.h"
63 	#include "Win32BackupService.h"
64 
65 	extern Win32BackupService* gpDaemonService;
66 #endif
67 
main(int argc,const char * argv[])68 int main(int argc, const char *argv[])
69 {
70 	int ExitCode = 0;
71 
72 	MAINHELPER_START
73 
74 	Logging::SetProgramName("bbackupd");
75 	Logging::ToConsole(true);
76 	Logging::ToSyslog (true);
77 
78 #ifdef WIN32
79 
80 	EnableBackupRights();
81 
82 	gpDaemonService = new Win32BackupService();
83 	ExitCode = gpDaemonService->Daemon::Main(
84 		BOX_GET_DEFAULT_BBACKUPD_CONFIG_FILE,
85 		argc, argv);
86  	delete gpDaemonService;
87 
88 #else // !WIN32
89 
90 	BackupDaemon daemon;
91 	ExitCode = daemon.Main(BOX_GET_DEFAULT_BBACKUPD_CONFIG_FILE,
92 		argc, argv);
93 
94 #endif // WIN32
95 
96 	MAINHELPER_END
97 
98 	return ExitCode;
99 }
100