summaryrefslogtreecommitdiff
path: root/bin/bbackupd/bbackupd.cpp
blob: bb64f745b722fc41c90d02d5c76fcdd3a61545e6 (plain)
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
// --------------------------------------------------------------------------
//
// File
//		Name:    bbackupd.cpp
//		Purpose: main file for backup daemon
//		Created: 2003/10/11
//
// --------------------------------------------------------------------------

#include "Box.h"
#include "BackupDaemon.h"
#include "MainHelper.h"
#include "BoxPortsAndFiles.h"
#include "BackupStoreException.h"
#include "Logging.h"

#include "MemLeakFindOn.h"

#ifdef WIN32
	#include "Win32ServiceFunctions.h"
	#include "Win32BackupService.h"

	extern Win32BackupService* gpDaemonService;
#endif

int main(int argc, const char *argv[])
{
	int ExitCode = 0;

	MAINHELPER_START

	Logging::SetProgramName("bbackupd");
	Logging::ToConsole(true);
	Logging::ToSyslog (true);
	
#ifdef WIN32

	EnableBackupRights();

	gpDaemonService = new Win32BackupService();
	ExitCode = gpDaemonService->Daemon::Main(
		BOX_GET_DEFAULT_BBACKUPD_CONFIG_FILE,
		argc, argv);
 	delete gpDaemonService;

#else // !WIN32

	BackupDaemon daemon;
	ExitCode = daemon.Main(BOX_GET_DEFAULT_BBACKUPD_CONFIG_FILE,
		argc, argv);

#endif // WIN32

	MAINHELPER_END

	return ExitCode;
}