-CREATE DATABASE bacula $ENCODING;\r
+CREATE DATABASE bacula ENCODING 'SQL_ASCII';\r
ALTER DATABASE bacula SET datestyle TO 'ISO, YMD';\r
DROP TABLE IF EXISTS Client;\r
DROP TABLE IF EXISTS Job;\r
DROP TABLE IF EXISTS Media;\r
-DROP TABLE IF EXISTS MAC;\r
DROP TABLE IF EXISTS JobMedia;\r
DROP TABLE IF EXISTS Pool;\r
DROP TABLE IF EXISTS MultiVolume;\r
DROP TABLE IF EXISTS CDImages;\r
DROP TABLE IF EXISTS Status;\r
DROP TABLE IF EXISTS MAC;\r
+DROP TABLE IF EXISTS Log;\r
DROP TABLE IF EXISTS Location;\r
+DROP TABLE IF EXISTS LocationLog;\r
-create user ${USER};\r
+create user bacula;\r
\r
-- for tables\r
-grant all on unsavedfiles to ${USER};\r
-grant all on basefiles to ${USER};\r
-grant all on jobmedia to ${USER};\r
-grant all on file to ${USER};\r
-grant all on job to ${USER};\r
-grant all on media to ${USER};\r
-grant all on client to ${USER};\r
-grant all on pool to ${USER};\r
-grant all on fileset to ${USER};\r
-grant all on path to ${USER};\r
-grant all on filename to ${USER};\r
-grant all on counters to ${USER};\r
-grant all on version to ${USER};\r
-grant all on cdimages to ${USER};\r
-grant all on mediatype to ${USER};\r
-grant all on storage to ${USER};\r
-grant all on device to ${USER};\r
-grant all on status to ${USER};\r
+grant all on unsavedfiles to bacula;\r
+grant all on basefiles to bacula;\r
+grant all on jobmedia to bacula;\r
+grant all on file to bacula;\r
+grant all on job to bacula;\r
+grant all on media to bacula;\r
+grant all on client to bacula;\r
+grant all on pool to bacula;\r
+grant all on fileset to bacula;\r
+grant all on path to bacula;\r
+grant all on filename to bacula;\r
+grant all on counters to bacula;\r
+grant all on version to bacula;\r
+grant all on cdimages to bacula;\r
+grant all on mediatype to bacula;\r
+grant all on storage to bacula;\r
+grant all on device to bacula;\r
+grant all on status to bacula;\r
\r
-- for sequences on those tables\r
\r
-grant select, update on filename_filenameid_seq to ${USER};\r
-grant select, update on path_pathid_seq to ${USER};\r
-grant select, update on fileset_filesetid_seq to ${USER};\r
-grant select, update on pool_poolid_seq to ${USER};\r
-grant select, update on client_clientid_seq to ${USER};\r
-grant select, update on media_mediaid_seq to ${USER};\r
-grant select, update on job_jobid_seq to ${USER};\r
-grant select, update on file_fileid_seq to ${USER};\r
-grant select, update on jobmedia_jobmediaid_seq to ${USER};\r
-grant select, update on basefiles_baseid_seq to ${USER};\r
-grant select, update on storage_storageid_seq to ${USER};\r
-grant select, update on mediatype_mediatypeid_seq to ${USER};\r
-grant select, update on device_deviceid_seq to ${USER};\r
+grant select, update on filename_filenameid_seq to bacula;\r
+grant select, update on path_pathid_seq to bacula;\r
+grant select, update on fileset_filesetid_seq to bacula;\r
+grant select, update on pool_poolid_seq to bacula;\r
+grant select, update on client_clientid_seq to bacula;\r
+grant select, update on media_mediaid_seq to bacula;\r
+grant select, update on job_jobid_seq to bacula;\r
+grant select, update on file_fileid_seq to bacula;\r
+grant select, update on jobmedia_jobmediaid_seq to bacula;\r
+grant select, update on basefiles_baseid_seq to bacula;\r
+grant select, update on storage_storageid_seq to bacula;\r
+grant select, update on mediatype_mediatypeid_seq to bacula;\r
+grant select, update on device_deviceid_seq to bacula;\r
\r
CREATE TABLE File (\r
FileId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,\r
- FileIndex INTEGER UNSIGNED NOT NULL DEFAULT 0,\r
+ FileIndex INTEGER UNSIGNED DEFAULT 0,\r
JobId INTEGER UNSIGNED NOT NULL REFERENCES Job,\r
PathId INTEGER UNSIGNED NOT NULL REFERENCES Path,\r
FilenameId INTEGER UNSIGNED NOT NULL REFERENCES Filename,\r
- MarkId INTEGER UNSIGNED NOT NULL DEFAULT 0,\r
+ MarkId INTEGER UNSIGNED DEFAULT 0,\r
LStat TINYBLOB NOT NULL,\r
- MD5 TINYBLOB NOT NULL,\r
+ MD5 TINYBLOB,\r
PRIMARY KEY(FileId),\r
INDEX (JobId),\r
INDEX (JobId, PathId, FilenameId)\r
CREATE TABLE Device (\r
DeviceId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,\r
Name TINYBLOB NOT NULL,\r
- MediaTypeId INTEGER UNSIGNED NOT NULL REFERENCES MediaType,\r
- StorageId INTEGER UNSIGNED NOT NULL REFERENCES Storage,\r
+ MediaTypeId INTEGER UNSIGNED DEFAULT 0 REFERENCES MediaType,\r
+ StorageId INTEGER UNSIGNED DEFAULT 0 REFERENCES Storage,\r
DevMounts INTEGER UNSIGNED DEFAULT 0,\r
DevReadBytes BIGINT UNSIGNED DEFAULT 0,\r
DevWriteBytes BIGINT UNSIGNED DEFAULT 0,\r
Name TINYBLOB NOT NULL,\r
Type BINARY(1) NOT NULL,\r
Level BINARY(1) NOT NULL,\r
- ClientId INTEGER NULL REFERENCES Client,\r
+ ClientId INTEGER DEFAULT 0 REFERENCES Client,\r
JobStatus BINARY(1) NOT NULL,\r
- SchedTime DATETIME NOT NULL,\r
- StartTime DATETIME NULL,\r
- EndTime DATETIME NULL,\r
- JobTDate BIGINT UNSIGNED NOT NULL,\r
- VolSessionId INTEGER UNSIGNED NOT NULL DEFAULT 0,\r
- VolSessionTime INTEGER UNSIGNED NOT NULL DEFAULT 0,\r
- JobFiles INTEGER UNSIGNED NOT NULL DEFAULT 0,\r
- JobBytes BIGINT UNSIGNED NOT NULL DEFAULT 0,\r
- JobErrors INTEGER UNSIGNED NOT NULL DEFAULT 0,\r
- JobMissingFiles INTEGER UNSIGNED NOT NULL DEFAULT 0,\r
- PoolId INTEGER UNSIGNED NULL REFERENCES Pool,\r
- FileSetId INTEGER UNSIGNED NULL REFERENCES FileSet,\r
- PurgedFiles TINYINT NOT NULL DEFAULT 0,\r
- HasBase TINYINT NOT NULL DEFAULT 0,\r
+ SchedTime DATETIME DEFAULT 0,\r
+ StartTime DATETIME DEFAULT 0,\r
+ EndTime DATETIME DEFAULT 0,\r
+ RealEndTime DATETIME DEFAULT 0,\r
+ JobTDate BIGINT UNSIGNED DEFAULT 0,\r
+ VolSessionId INTEGER UNSIGNED DEFAULT 0,\r
+ VolSessionTime INTEGER UNSIGNED DEFAULT 0,\r
+ JobFiles INTEGER UNSIGNED DEFAULT 0,\r
+ JobBytes BIGINT UNSIGNED DEFAULT 0,\r
+ JobErrors INTEGER UNSIGNED DEFAULT 0,\r
+ JobMissingFiles INTEGER UNSIGNED DEFAULT 0,\r
+ PoolId INTEGER UNSIGNED DEFAULT 0 REFERENCES Pool,\r
+ FileSetId INTEGER UNSIGNED DEFAULT 0 REFERENCES FileSet,\r
+ PriorJobId INTEGER UNSIGNED DEFAULT 0 REFERENCES Job,\r
+ PurgedFiles TINYINT DEFAULT 0,\r
+ HasBase TINYINT DEFAULT 0,\r
PRIMARY KEY(JobId),\r
INDEX (Name(128))\r
);\r
\r
-CREATE TABLE MAC (\r
- JobId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,\r
- OriginalJobId INTEGER UNSIGNED NOT NULL,\r
- JobType BINARY(1) NOT NULL,\r
- JobLevel BINARY(1) NOT NULL,\r
- SchedTime DATETIME NOT NULL,\r
- StartTime DATETIME NOT NULL,\r
- EndTime DATETIME NOT NULL,\r
- JobTDate BIGINT UNSIGNED NOT NULL,\r
- PRIMARY KEY(JobId)\r
- );\r
\r
CREATE TABLE Location (\r
LocationId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,\r
Location TINYBLOB NOT NULL,\r
+ Cost INTEGER DEFAULT 0,\r
+ Enabled TINYINT,\r
PRIMARY KEY(LocationId)\r
);\r
\r
+CREATE TABLE LocationLog (\r
+ LocLogId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,\r
+ Date DATETIME DEFAULT 0,\r
+ Comment BLOB NOT NULL,\r
+ MediaId INTEGER UNSIGNED DEFAULT 0 REFERENCES Media,\r
+ LocationId INTEGER UNSIGNED DEFAULT 0 REFERENCES Location,\r
+ NewVolStatus ENUM('Full', 'Archive', 'Append', 'Recycle', 'Purged',\r
+ 'Read-Only', 'Disabled', 'Error', 'Busy', 'Used', 'Cleaning') NOT NULL,\r
+ NewEnabled TINYINT,\r
+ PRIMARY KEY(LocLogId)\r
+);\r
+\r
+\r
# \r
CREATE TABLE FileSet (\r
FileSetId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,\r
FileSet TINYBLOB NOT NULL,\r
- MD5 TINYBLOB NOT NULL,\r
- CreateTime DATETIME NOT NULL,\r
+ MD5 TINYBLOB,\r
+ CreateTime DATETIME DEFAULT 0,\r
PRIMARY KEY(FileSetId)\r
);\r
\r
JobMediaId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,\r
JobId INTEGER UNSIGNED NOT NULL REFERENCES Job,\r
MediaId INTEGER UNSIGNED NOT NULL REFERENCES Media,\r
- FirstIndex INTEGER UNSIGNED NOT NULL DEFAULT 0,\r
- LastIndex INTEGER UNSIGNED NOT NULL DEFAULT 0,\r
- StartFile INTEGER UNSIGNED NOT NULL DEFAULT 0,\r
- EndFile INTEGER UNSIGNED NOT NULL DEFAULT 0,\r
- StartBlock INTEGER UNSIGNED NOT NULL DEFAULT 0,\r
- EndBlock INTEGER UNSIGNED NOT NULL DEFAULT 0,\r
- VolIndex INTEGER UNSIGNED NOT NULL DEFAULT 0,\r
- Copy INTEGER UNSIGNED NOT NULL DEFAULT 0,\r
- Stripe INTEGER UNSIGNED NOT NULL DEFAULT 0,\r
+ FirstIndex INTEGER UNSIGNED DEFAULT 0,\r
+ LastIndex INTEGER UNSIGNED DEFAULT 0,\r
+ StartFile INTEGER UNSIGNED DEFAULT 0,\r
+ EndFile INTEGER UNSIGNED DEFAULT 0,\r
+ StartBlock INTEGER UNSIGNED DEFAULT 0,\r
+ EndBlock INTEGER UNSIGNED DEFAULT 0,\r
+ VolIndex INTEGER UNSIGNED DEFAULT 0,\r
+ Copy INTEGER UNSIGNED DEFAULT 0,\r
+ Stripe INTEGER UNSIGNED DEFAULT 0,\r
PRIMARY KEY(JobMediaId),\r
INDEX (JobId, MediaId)\r
);\r
CREATE TABLE Media (\r
MediaId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,\r
VolumeName TINYBLOB NOT NULL,\r
- Slot INTEGER NOT NULL DEFAULT 0,\r
- PoolId INTEGER UNSIGNED NOT NULL REFERENCES Pool,\r
+ Slot INTEGER DEFAULT 0,\r
+ PoolId INTEGER UNSIGNED DEFAULT 0 REFERENCES Pool,\r
MediaType TINYBLOB NOT NULL,\r
- MediaTypeId INTEGER UNSIGNED NOT NULL REFERENCES MediaType,\r
- LabelType TINYINT NOT NULL DEFAULT 0,\r
- FirstWritten DATETIME NULL,\r
- LastWritten DATETIME NULL,\r
- LabelDate DATETIME NULL,\r
- VolJobs INTEGER UNSIGNED NOT NULL DEFAULT 0,\r
- VolFiles INTEGER UNSIGNED NOT NULL DEFAULT 0,\r
- VolBlocks INTEGER UNSIGNED NOT NULL DEFAULT 0,\r
- VolMounts INTEGER UNSIGNED NOT NULL DEFAULT 0,\r
- VolBytes BIGINT UNSIGNED NOT NULL DEFAULT 0,\r
- VolParts INTEGER UNSIGNED NOT NULL DEFAULT 0,\r
- VolErrors INTEGER UNSIGNED NOT NULL DEFAULT 0,\r
- VolWrites INTEGER UNSIGNED NOT NULL DEFAULT 0,\r
- VolCapacityBytes BIGINT UNSIGNED NOT NULL,\r
+ MediaTypeId INTEGER UNSIGNED DEFAULT 0 REFERENCES MediaType,\r
+ LabelType TINYINT DEFAULT 0,\r
+ FirstWritten DATETIME DEFAULT 0,\r
+ LastWritten DATETIME DEFAULT 0,\r
+ LabelDate DATETIME DEFAULT 0,\r
+ VolJobs INTEGER UNSIGNED DEFAULT 0,\r
+ VolFiles INTEGER UNSIGNED DEFAULT 0,\r
+ VolBlocks INTEGER UNSIGNED DEFAULT 0,\r
+ VolMounts INTEGER UNSIGNED DEFAULT 0,\r
+ VolBytes BIGINT UNSIGNED DEFAULT 0,\r
+ VolParts INTEGER UNSIGNED DEFAULT 0,\r
+ VolErrors INTEGER UNSIGNED DEFAULT 0,\r
+ VolWrites INTEGER UNSIGNED DEFAULT 0,\r
+ VolCapacityBytes BIGINT UNSIGNED DEFAULT 0,\r
VolStatus ENUM('Full', 'Archive', 'Append', 'Recycle', 'Purged',\r
'Read-Only', 'Disabled', 'Error', 'Busy', 'Used', 'Cleaning') NOT NULL,\r
- Recycle TINYINT NOT NULL DEFAULT 0,\r
- VolRetention BIGINT UNSIGNED NOT NULL DEFAULT 0,\r
- VolUseDuration BIGINT UNSIGNED NOT NULL DEFAULT 0,\r
- MaxVolJobs INTEGER UNSIGNED NOT NULL DEFAULT 0,\r
- MaxVolFiles INTEGER UNSIGNED NOT NULL DEFAULT 0,\r
- MaxVolBytes BIGINT UNSIGNED NOT NULL DEFAULT 0,\r
- InChanger TINYINT NOT NULL DEFAULT 0,\r
- StorageId INTEGER UNSIGNED NOT NULL REFERENCES Storage,\r
- DeviceId INTEGER UNSIGNED NOT NULL REFERENCES Device,\r
- MediaAddressing TINYINT NOT NULL DEFAULT 0,\r
- VolReadTime BIGINT UNSIGNED NOT NULL DEFAULT 0,\r
- VolWriteTime BIGINT UNSIGNED NOT NULL DEFAULT 0,\r
- EndFile INTEGER UNSIGNED NOT NULL DEFAULT 0,\r
- EndBlock INTEGER UNSIGNED NOT NULL DEFAULT 0,\r
- LocationId INTEGER UNSIGNED NOT NULL REFERENCES Location,\r
+ Enabled TINYINT DEFAULT 1,\r
+ Recycle TINYINT DEFAULT 0,\r
+ VolRetention BIGINT UNSIGNED DEFAULT 0,\r
+ VolUseDuration BIGINT UNSIGNED DEFAULT 0,\r
+ MaxVolJobs INTEGER UNSIGNED DEFAULT 0,\r
+ MaxVolFiles INTEGER UNSIGNED DEFAULT 0,\r
+ MaxVolBytes BIGINT UNSIGNED DEFAULT 0,\r
+ InChanger TINYINT DEFAULT 0,\r
+ StorageId INTEGER UNSIGNED DEFAULT 0 REFERENCES Storage,\r
+ DeviceId INTEGER UNSIGNED DEFAULT 0 REFERENCES Device,\r
+ MediaAddressing TINYINT DEFAULT 0,\r
+ VolReadTime BIGINT UNSIGNED DEFAULT 0,\r
+ VolWriteTime BIGINT UNSIGNED DEFAULT 0,\r
+ EndFile INTEGER UNSIGNED DEFAULT 0,\r
+ EndBlock INTEGER UNSIGNED DEFAULT 0,\r
+ LocationId INTEGER UNSIGNED DEFAULT 0 REFERENCES Location,\r
RecycleCount INTEGER UNSIGNED DEFAULT 0,\r
- InitialWrite DATETIME NULL,\r
+ InitialWrite DATETIME DEFAULT 0,\r
ScratchPoolId INTEGER UNSIGNED DEFAULT 0 REFERENCES Pool,\r
RecyclePoolId INTEGER UNSIGNED DEFAULT 0 REFERENCES Pool,\r
+ Comment BLOB,\r
PRIMARY KEY(MediaId),\r
INDEX (PoolId)\r
);\r
CREATE TABLE Pool (\r
PoolId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,\r
Name TINYBLOB NOT NULL,\r
- NumVols INTEGER UNSIGNED NOT NULL DEFAULT 0,\r
- MaxVols INTEGER UNSIGNED NOT NULL DEFAULT 0,\r
- UseOnce TINYINT NOT NULL,\r
- UseCatalog TINYINT NOT NULL,\r
+ NumVols INTEGER UNSIGNED DEFAULT 0,\r
+ MaxVols INTEGER UNSIGNED DEFAULT 0,\r
+ UseOnce TINYINT DEFAULT 0,\r
+ UseCatalog TINYINT DEFAULT 0,\r
AcceptAnyVolume TINYINT DEFAULT 0,\r
- VolRetention BIGINT UNSIGNED NOT NULL,\r
- VolUseDuration BIGINT UNSIGNED NOT NULL,\r
- MaxVolJobs INTEGER UNSIGNED NOT NULL DEFAULT 0,\r
- MaxVolFiles INTEGER UNSIGNED NOT NULL DEFAULT 0,\r
- MaxVolBytes BIGINT UNSIGNED NOT NULL,\r
+ VolRetention BIGINT UNSIGNED DEFAULT 0,\r
+ VolUseDuration BIGINT UNSIGNED DEFAULT 0,\r
+ MaxVolJobs INTEGER UNSIGNED DEFAULT 0,\r
+ MaxVolFiles INTEGER UNSIGNED DEFAULT 0,\r
+ MaxVolBytes BIGINT UNSIGNED DEFAULT 0,\r
AutoPrune TINYINT DEFAULT 0,\r
Recycle TINYINT DEFAULT 0,\r
PoolType ENUM('Backup', 'Copy', 'Cloned', 'Archive', 'Migration', 'Scratch') NOT NULL,\r
- LabelType TINYINT NOT NULL DEFAULT 0,\r
+ LabelType TINYINT DEFAULT 0,\r
LabelFormat TINYBLOB,\r
Enabled TINYINT DEFAULT 1,\r
ScratchPoolId INTEGER UNSIGNED DEFAULT 0 REFERENCES Pool,\r
Name TINYBLOB NOT NULL,\r
Uname TINYBLOB NOT NULL, /* full uname -a of client */\r
AutoPrune TINYINT DEFAULT 0,\r
- FileRetention BIGINT UNSIGNED NOT NULL,\r
- JobRetention BIGINT UNSIGNED NOT NULL,\r
+ FileRetention BIGINT UNSIGNED DEFAULT 0,\r
+ JobRetention BIGINT UNSIGNED DEFAULT 0,\r
UNIQUE (Name(128)),\r
PRIMARY KEY(ClientId)\r
);\r
\r
+CREATE TABLE Log (\r
+ LogId INTEGER UNSIGNED AUTO_INCREMENT,\r
+ JobId INTEGER UNSIGNED DEFAULT 0 REFERENCES Job,\r
+ Time DATETIME DEFAULT 0,\r
+ LogText BLOB NOT NULL,\r
+ PRIMARY KEY(LogId),\r
+ INDEX (JobId)\r
+ );\r
+\r
+\r
CREATE TABLE BaseFiles (\r
BaseId INTEGER UNSIGNED AUTO_INCREMENT,\r
BaseJobId INTEGER UNSIGNED NOT NULL REFERENCES Job,\r
\r
CREATE TABLE Counters (\r
Counter TINYBLOB NOT NULL,\r
- MinValue INTEGER,\r
- MaxValue INTEGER,\r
- CurrentValue INTEGER,\r
+ MinValue INTEGER DEFAULT 0,\r
+ MaxValue INTEGER DEFAULT 0,\r
+ CurrentValue INTEGER DEFAULT 0,\r
WrapCounter TINYBLOB NOT NULL,\r
PRIMARY KEY (Counter(128))\r
);\r
);\r
\r
-- Initialize Version \r
-INSERT INTO Version (VersionId) VALUES (9);\r
+INSERT INTO Version (VersionId) VALUES (10);\r
+@echo off\r
rem\r
rem Script to update MySQL tables from version 1.38 to 1.39\r
rem\r
-echo " "\r
-echo "This script will update a Bacula MySQL database from version 9 to 9"\r
-echo "Depending on the size of your database,"\r
-echo "this script may take several minutes to run."\r
-echo " "\r
+echo.\r
+echo This script will update a Bacula MySQL database from version 9 to 10\r
+echo Depending on the size of your database,\r
+echo this script may take several minutes to run.\r
+echo.\r
\r
-if %SQL_BINDIR%/mysql $* -f < update_mysql_tables.sql\r
+"%SQL_BINDIR%\mysql" %* -f -u bacula --password=bacula bacula < update_mysql_tables.sql\r
set RESULT=%ERRORLEVEL%\r
if %RESULT% GTR 0 goto :ERROR\r
echo "Update of Bacula MySQL tables succeeded."\r
exit /b 0\r
\r
:ERROR\r
-echo "Update of Bacula MySQL tables failed."\r
+echo Update of Bacula MySQL tables failed.\r
exit /b %RESULT%\r
USE bacula;\r
\r
+DROP TABLE IF EXISTS MAC;\r
+DROP TABLE IF EXISTS Log;\r
+DROP TABLE IF EXISTS Location;\r
+DROP TABLE IF EXISTS LocationLog;\r
+\r
+CREATE TABLE Log (\r
+ LogId INTEGER UNSIGNED AUTO_INCREMENT,\r
+ JobId INTEGER UNSIGNED DEFAULT 0 REFERENCES Job,\r
+ Time DATETIME DEFAULT 0,\r
+ LogText BLOB NOT NULL,\r
+ PRIMARY KEY(LogId),\r
+ INDEX (JobId)\r
+ );\r
+\r
+CREATE TABLE Location (\r
+ LocationId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,\r
+ Location TINYBLOB NOT NULL,\r
+ Cost INTEGER DEFAULT 0,\r
+ Enabled TINYINT,\r
+ PRIMARY KEY(LocationId)\r
+ );\r
+\r
+CREATE TABLE LocationLog (\r
+ LocLogId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,\r
+ Date DATETIME DEFAULT 0,\r
+ Comment BLOB,\r
+ MediaId INTEGER UNSIGNED DEFAULT 0 REFERENCES Media,\r
+ LocationId INTEGER UNSIGNED DEFAULT 0 REFERENCES Location,\r
+ NewVolStatus ENUM('Full', 'Archive', 'Append', 'Recycle', 'Purged',\r
+ 'Read-Only', 'Disabled', 'Error', 'Busy', 'Used', 'Cleaning') NOT NULL,\r
+ NewEnabled TINYINT,\r
+ PRIMARY KEY(LocLogId)\r
+);\r
+\r
ALTER TABLE Media ADD COLUMN MediaTypeId INTEGER UNSIGNED DEFAULT 0 REFERENCES MediaType;\r
ALTER TABLE Media ADD COLUMN DeviceId INTEGER UNSIGNED DEFAULT 0 REFERENCES Device;\r
ALTER TABLE Media ADD COLUMN LocationId INTEGER UNSIGNED DEFAULT 0 REFERENCES Location;\r
ALTER TABLE Media ADD COLUMN InitialWrite DATETIME DEFAULT 0;\r
ALTER TABLE Media ADD COLUMN ScratchPoolId INTEGER UNSIGNED DEFAULT 0 REFERENCES Pool;\r
ALTER TABLE Media ADD COLUMN RecyclePoolId INTEGER UNSIGNED DEFAULT 0 REFERENCES Pool;\r
+ALTER TABLE Media ADD COLUMN Enabled TINYINT DEFAULT 1;\r
+ALTER TABLE Media ADD COLUMN Comment BLOB;\r
\r
+ALTER TABLE JobMedia DROP COLUMN Stripe;\r
\r
-CREATE TABLE MAC (\r
- JobId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,\r
- OriginalJobId INTEGER UNSIGNED NOT NULL,\r
- JobType BINARY(1) NOT NULL,\r
- JobLevel BINARY(1) NOT NULL,\r
- SchedTime DATETIME NOT NULL,\r
- StartTime DATETIME NOT NULL,\r
- EndTime DATETIME NOT NULL,\r
- JobTDate BIGINT UNSIGNED NOT NULL,\r
- PRIMARY KEY(JobId)\r
- );\r
+ALTER TABLE Job ADD COLUMN PriorJobId INTEGER UNSIGNED DEFAULT 0 REFERENCES Job;\r
+ALTER TABLE Job ADD COLUMN RealEndTime DATETIME DEFAULT 0;\r
\r
-CREATE TABLE Location (\r
- LocationId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,\r
- Location TINYBLOB NOT NULL,\r
- PRIMARY KEY(LocationId)\r
- );\r
\r
\r
DELETE FROM Version;\r
-INSERT INTO Version (VersionId) VALUES (9);\r
+INSERT INTO Version (VersionId) VALUES (10);\r
UsePrecompiledHeader="0"\r
BrowseInformation="1"\r
WarningLevel="3"\r
- Detect64BitPortabilityProblems="false"\r
SuppressStartupBanner="true"\r
+ Detect64BitPortabilityProblems="false"\r
DebugInformationFormat="4"\r
/>\r
<Tool\r
EnableFunctionLevelLinking="true"\r
BrowseInformation="1"\r
WarningLevel="3"\r
- Detect64BitPortabilityProblems="false"\r
SuppressStartupBanner="true"\r
+ Detect64BitPortabilityProblems="false"\r
DebugInformationFormat="3"\r
/>\r
<Tool\r
RelativePath="..\..\dird\admin.c"\r
>\r
<FileConfiguration\r
- Name="Release|Win32"\r
+ Name="Debug|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
/>\r
</FileConfiguration>\r
<FileConfiguration\r
- Name="Debug|Win32"\r
+ Name="Release|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
RelativePath="..\..\dird\authenticate.c"\r
>\r
<FileConfiguration\r
- Name="Release|Win32"\r
+ Name="Debug|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
/>\r
</FileConfiguration>\r
<FileConfiguration\r
- Name="Debug|Win32"\r
+ Name="Release|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
RelativePath="..\..\dird\autoprune.c"\r
>\r
<FileConfiguration\r
- Name="Release|Win32"\r
+ Name="Debug|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
/>\r
</FileConfiguration>\r
<FileConfiguration\r
- Name="Debug|Win32"\r
+ Name="Release|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
RelativePath="..\..\dird\backup.c"\r
>\r
<FileConfiguration\r
- Name="Release|Win32"\r
+ Name="Debug|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
/>\r
</FileConfiguration>\r
<FileConfiguration\r
- Name="Debug|Win32"\r
+ Name="Release|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
RelativePath="..\..\dird\bsr.c"\r
>\r
<FileConfiguration\r
- Name="Release|Win32"\r
+ Name="Debug|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
/>\r
</FileConfiguration>\r
<FileConfiguration\r
- Name="Debug|Win32"\r
+ Name="Release|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
RelativePath="..\..\dird\catreq.c"\r
>\r
<FileConfiguration\r
- Name="Release|Win32"\r
+ Name="Debug|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
/>\r
</FileConfiguration>\r
<FileConfiguration\r
- Name="Debug|Win32"\r
+ Name="Release|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
RelativePath="..\..\dird\dird.c"\r
>\r
<FileConfiguration\r
- Name="Release|Win32"\r
+ Name="Debug|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
/>\r
</FileConfiguration>\r
<FileConfiguration\r
- Name="Debug|Win32"\r
+ Name="Release|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
RelativePath="..\..\dird\dird_conf.c"\r
>\r
<FileConfiguration\r
- Name="Release|Win32"\r
+ Name="Debug|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
/>\r
</FileConfiguration>\r
<FileConfiguration\r
- Name="Debug|Win32"\r
+ Name="Release|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
RelativePath="..\..\dird\expand.c"\r
>\r
<FileConfiguration\r
- Name="Release|Win32"\r
+ Name="Debug|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
/>\r
</FileConfiguration>\r
<FileConfiguration\r
- Name="Debug|Win32"\r
+ Name="Release|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
RelativePath="..\..\dird\fd_cmds.c"\r
>\r
<FileConfiguration\r
- Name="Release|Win32"\r
+ Name="Debug|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
/>\r
</FileConfiguration>\r
<FileConfiguration\r
- Name="Debug|Win32"\r
+ Name="Release|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
RelativePath="..\..\dird\getmsg.c"\r
>\r
<FileConfiguration\r
- Name="Release|Win32"\r
+ Name="Debug|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
/>\r
</FileConfiguration>\r
<FileConfiguration\r
- Name="Debug|Win32"\r
+ Name="Release|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
RelativePath="..\..\dird\inc_conf.c"\r
>\r
<FileConfiguration\r
- Name="Release|Win32"\r
+ Name="Debug|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
/>\r
</FileConfiguration>\r
<FileConfiguration\r
- Name="Debug|Win32"\r
+ Name="Release|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
RelativePath="..\..\dird\job.c"\r
>\r
<FileConfiguration\r
- Name="Release|Win32"\r
+ Name="Debug|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
/>\r
</FileConfiguration>\r
<FileConfiguration\r
- Name="Debug|Win32"\r
+ Name="Release|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
RelativePath="..\..\dird\jobq.c"\r
>\r
<FileConfiguration\r
- Name="Release|Win32"\r
+ Name="Debug|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
/>\r
</FileConfiguration>\r
<FileConfiguration\r
- Name="Debug|Win32"\r
+ Name="Release|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
RelativePath="..\..\dird\migrate.c"\r
>\r
<FileConfiguration\r
- Name="Release|Win32"\r
+ Name="Debug|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
/>\r
</FileConfiguration>\r
<FileConfiguration\r
- Name="Debug|Win32"\r
+ Name="Release|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
RelativePath="..\..\dird\mountreq.c"\r
>\r
<FileConfiguration\r
- Name="Release|Win32"\r
+ Name="Debug|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
/>\r
</FileConfiguration>\r
<FileConfiguration\r
- Name="Debug|Win32"\r
+ Name="Release|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
RelativePath="..\..\dird\msgchan.c"\r
>\r
<FileConfiguration\r
- Name="Release|Win32"\r
+ Name="Debug|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
/>\r
</FileConfiguration>\r
<FileConfiguration\r
- Name="Debug|Win32"\r
+ Name="Release|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
RelativePath="..\..\dird\newvol.c"\r
>\r
<FileConfiguration\r
- Name="Release|Win32"\r
+ Name="Debug|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
/>\r
</FileConfiguration>\r
<FileConfiguration\r
- Name="Debug|Win32"\r
+ Name="Release|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
RelativePath="..\..\dird\next_vol.c"\r
>\r
<FileConfiguration\r
- Name="Release|Win32"\r
+ Name="Debug|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
/>\r
</FileConfiguration>\r
<FileConfiguration\r
- Name="Debug|Win32"\r
+ Name="Release|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
RelativePath="..\..\dird\pythondir.c"\r
>\r
<FileConfiguration\r
- Name="Release|Win32"\r
+ Name="Debug|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
/>\r
</FileConfiguration>\r
<FileConfiguration\r
- Name="Debug|Win32"\r
+ Name="Release|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
RelativePath="..\..\dird\recycle.c"\r
>\r
<FileConfiguration\r
- Name="Release|Win32"\r
+ Name="Debug|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
/>\r
</FileConfiguration>\r
<FileConfiguration\r
- Name="Debug|Win32"\r
+ Name="Release|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
RelativePath="..\..\dird\restore.c"\r
>\r
<FileConfiguration\r
- Name="Release|Win32"\r
+ Name="Debug|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
/>\r
</FileConfiguration>\r
<FileConfiguration\r
- Name="Debug|Win32"\r
+ Name="Release|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
RelativePath="..\..\dird\run_conf.c"\r
>\r
<FileConfiguration\r
- Name="Release|Win32"\r
+ Name="Debug|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
/>\r
</FileConfiguration>\r
<FileConfiguration\r
- Name="Debug|Win32"\r
+ Name="Release|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
RelativePath="..\..\dird\scheduler.c"\r
>\r
<FileConfiguration\r
- Name="Release|Win32"\r
+ Name="Debug|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
/>\r
</FileConfiguration>\r
<FileConfiguration\r
- Name="Debug|Win32"\r
+ Name="Release|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
RelativePath="..\..\dird\ua_acl.c"\r
>\r
<FileConfiguration\r
- Name="Release|Win32"\r
+ Name="Debug|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
/>\r
</FileConfiguration>\r
<FileConfiguration\r
- Name="Debug|Win32"\r
+ Name="Release|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
RelativePath="..\..\dird\ua_cmds.c"\r
>\r
<FileConfiguration\r
- Name="Release|Win32"\r
+ Name="Debug|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
/>\r
</FileConfiguration>\r
<FileConfiguration\r
- Name="Debug|Win32"\r
+ Name="Release|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
RelativePath="..\..\dird\ua_dotcmds.c"\r
>\r
<FileConfiguration\r
- Name="Release|Win32"\r
+ Name="Debug|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
/>\r
</FileConfiguration>\r
<FileConfiguration\r
- Name="Debug|Win32"\r
+ Name="Release|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
RelativePath="..\..\dird\ua_input.c"\r
>\r
<FileConfiguration\r
- Name="Release|Win32"\r
+ Name="Debug|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
/>\r
</FileConfiguration>\r
<FileConfiguration\r
- Name="Debug|Win32"\r
+ Name="Release|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
RelativePath="..\..\dird\ua_label.c"\r
>\r
<FileConfiguration\r
- Name="Release|Win32"\r
+ Name="Debug|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
/>\r
</FileConfiguration>\r
<FileConfiguration\r
- Name="Debug|Win32"\r
+ Name="Release|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
RelativePath="..\..\dird\ua_output.c"\r
>\r
<FileConfiguration\r
- Name="Release|Win32"\r
+ Name="Debug|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
/>\r
</FileConfiguration>\r
<FileConfiguration\r
- Name="Debug|Win32"\r
+ Name="Release|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
RelativePath="..\..\dird\ua_prune.c"\r
>\r
<FileConfiguration\r
- Name="Release|Win32"\r
+ Name="Debug|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
/>\r
</FileConfiguration>\r
<FileConfiguration\r
- Name="Debug|Win32"\r
+ Name="Release|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
RelativePath="..\..\dird\ua_purge.c"\r
>\r
<FileConfiguration\r
- Name="Release|Win32"\r
+ Name="Debug|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
/>\r
</FileConfiguration>\r
<FileConfiguration\r
- Name="Debug|Win32"\r
+ Name="Release|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
RelativePath="..\..\dird\ua_query.c"\r
>\r
<FileConfiguration\r
- Name="Release|Win32"\r
+ Name="Debug|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
/>\r
</FileConfiguration>\r
<FileConfiguration\r
- Name="Debug|Win32"\r
+ Name="Release|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
RelativePath="..\..\dird\ua_restore.c"\r
>\r
<FileConfiguration\r
- Name="Release|Win32"\r
+ Name="Debug|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
/>\r
</FileConfiguration>\r
<FileConfiguration\r
- Name="Debug|Win32"\r
+ Name="Release|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
RelativePath="..\..\dird\ua_run.c"\r
>\r
<FileConfiguration\r
- Name="Release|Win32"\r
+ Name="Debug|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
/>\r
</FileConfiguration>\r
<FileConfiguration\r
- Name="Debug|Win32"\r
+ Name="Release|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
RelativePath="..\..\dird\ua_select.c"\r
>\r
<FileConfiguration\r
- Name="Release|Win32"\r
+ Name="Debug|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
/>\r
</FileConfiguration>\r
<FileConfiguration\r
- Name="Debug|Win32"\r
+ Name="Release|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
RelativePath="..\..\dird\ua_server.c"\r
>\r
<FileConfiguration\r
- Name="Release|Win32"\r
+ Name="Debug|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
/>\r
</FileConfiguration>\r
<FileConfiguration\r
- Name="Debug|Win32"\r
+ Name="Release|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
RelativePath="..\..\dird\ua_status.c"\r
>\r
<FileConfiguration\r
- Name="Release|Win32"\r
+ Name="Debug|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
/>\r
</FileConfiguration>\r
<FileConfiguration\r
- Name="Debug|Win32"\r
+ Name="Release|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
RelativePath="..\..\dird\ua_tree.c"\r
>\r
<FileConfiguration\r
- Name="Release|Win32"\r
+ Name="Debug|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
/>\r
</FileConfiguration>\r
<FileConfiguration\r
- Name="Debug|Win32"\r
+ Name="Release|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
RelativePath="..\..\dird\ua_update.c"\r
>\r
<FileConfiguration\r
- Name="Release|Win32"\r
+ Name="Debug|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
/>\r
</FileConfiguration>\r
<FileConfiguration\r
- Name="Debug|Win32"\r
+ Name="Release|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
RelativePath="..\..\dird\verify.c"\r
>\r
<FileConfiguration\r
- Name="Release|Win32"\r
+ Name="Debug|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
/>\r
</FileConfiguration>\r
<FileConfiguration\r
- Name="Debug|Win32"\r
+ Name="Release|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
extern void LogErrorMsg(char *msg);
// Standard command-line flag definitions
+const char BaculaSilent[] = "/silent";
+
const char BaculaRunService[] = "/service";
-const char BaculaRunServiceHelper[] = "/servicehelper";
const char BaculaRunAsUserApp[] = "/run";
+const char BaculaKillRunningCopy[] = "/kill";
const char BaculaInstallService[] = "/install";
const char BaculaRemoveService[] = "/remove";
-const char BaculaShowAbout[] = "/about";
-const char BaculaShowStatus[] = "/status";
-const char BaculaShowEvents[] = "/events";
-const char BaculaKillRunningCopy[] = "/kill";
-
const char BaculaShowHelp[] = "/help";
// Usage string
-const char BaculaUsageText[] = "Bacula [/run] [/kill] [/install] [/remove] [/about] [/status] [/events]\n";
+const char BaculaUsageText[] = "Bacula [/silent] [/service] [/run] [/kill] [/install] [/remove] [/help]\n";
void LogErrorMsg(char *msg, char *fname, int lineno);
#define log_error_message(msg) LogErrorMsg((msg), __FILE__, __LINE__)
char *szCmdLine = CmdLine;
char *wordPtr, *tempPtr;
int i, quote;
+ DWORD dwCharsWritten;
/* Save the application instance and main thread id */
hAppInstance = hInstance;
if (*szCmdLine != '"' && *wordPtr == '"') {
szCmdLine = wordPtr + 1;
}
-// MessageBox(NULL, szCmdLine, "Cmdline", MB_OK);
/* Build Unix style argc *argv[] */
/*
* Now process Windows command line options
*/
- bool argfound = false;
for (i = 0; i < (int)strlen(szCmdLine); i++) {
if (szCmdLine[i] <= ' ') {
continue;
break;
}
- argfound = true;
-
/* Now check for command-line arguments */
/* /silent install quietly -- no prompts */
- if (strnicmp(&szCmdLine[i], "/silent", strlen("/silent")) == 0) {
+ if (strnicmp(&szCmdLine[i], BaculaSilent, sizeof(BaculaSilent) - 1) == 0) {
silent = true;
- i += strlen("/silent");
+ i += sizeof(BaculaSilent) - 1;
continue;
}
/* /service start service */
- if (strnicmp(&szCmdLine[i], BaculaRunService, strlen(BaculaRunService)) == 0) {
+ if (strnicmp(&szCmdLine[i], BaculaRunService, sizeof(BaculaRunService) - 1) == 0) {
/* Run Bacula as a service */
return bacService::BaculaServiceMain();
}
/* /run (this is the default if no command line arguments) */
- if (strnicmp(&szCmdLine[i], BaculaRunAsUserApp, strlen(BaculaRunAsUserApp)) == 0) {
+ if (strnicmp(&szCmdLine[i], BaculaRunAsUserApp, sizeof(BaculaRunAsUserApp) - 1) == 0) {
/* Bacula is being run as a user-level program */
+ if (!AttachConsole(ATTACH_PARENT_PROCESS)) {
+ AllocConsole();
+ }
+ WriteConsole(GetStdHandle(STD_OUTPUT_HANDLE), "\r\n", 2, &dwCharsWritten, NULL);
+
return BaculaAppMain();
}
/* /install */
- if (strnicmp(&szCmdLine[i], BaculaInstallService, strlen(BaculaInstallService)) == 0) {
+ if (strnicmp(&szCmdLine[i], BaculaInstallService, sizeof(BaculaInstallService) - 1) == 0) {
/* Install Bacula as a service */
- bacService::InstallService(&szCmdLine[i + strlen(BaculaInstallService)]);
- i += strlen(BaculaInstallService);
- continue;
+ return bacService::InstallService(&szCmdLine[i + sizeof(BaculaInstallService) - 1]);
}
/* /remove */
- if (strnicmp(&szCmdLine[i], BaculaRemoveService, strlen(BaculaRemoveService)) == 0) {
+ if (strnicmp(&szCmdLine[i], BaculaRemoveService, sizeof(BaculaRemoveService) - 1) == 0) {
/* Remove the Bacula service */
- bacService::RemoveService();
- i += strlen(BaculaRemoveService);
- continue;
+ return bacService::RemoveService();
}
/* /kill */
- if (strnicmp(&szCmdLine[i], BaculaKillRunningCopy, strlen(BaculaKillRunningCopy)) == 0) {
+ if (strnicmp(&szCmdLine[i], BaculaKillRunningCopy, sizeof(BaculaKillRunningCopy) - 1) == 0) {
/* Kill running copy of Bacula */
- bacService::KillRunningCopy();
- i += strlen(BaculaKillRunningCopy);
- continue;
+ return bacService::KillRunningCopy() ? 0 : 1;
}
/* /help */
- if (strnicmp(&szCmdLine[i], BaculaShowHelp, strlen(BaculaShowHelp)) == 0) {
+ if (strnicmp(&szCmdLine[i], BaculaShowHelp, sizeof(BaculaShowHelp) - 1) == 0) {
MessageBox(NULL, BaculaUsageText, _("Bacula Usage"), MB_OK|MB_ICONINFORMATION);
- i += strlen(BaculaShowHelp);
- continue;
+ return 0;
}
MessageBox(NULL, szCmdLine, _("Bad Command Line Options"), MB_OK);
/* Show the usage dialog */
MessageBox(NULL, BaculaUsageText, _("Bacula Usage"), MB_OK | MB_ICONINFORMATION);
- break;
+ return 1;
}
/* If no arguments were given then just run */
- if (!argfound) {
- BaculaAppMain();
+ if (!AttachConsole(ATTACH_PARENT_PROCESS)) {
+ AllocConsole();
}
- return 0;
+ WriteConsole(GetStdHandle(STD_OUTPUT_HANDLE), "\r\n", 2, &dwCharsWritten, NULL);
+
+ return BaculaAppMain();
}
{
DWORD old_servicethread = g_servicethread;
-
pthread_detach(pthread_self());
/* Since we are the only thread with a message loop
p_SetProcessShutdownParameters(0x100, 0);
}
-#if 0
- HWND hservwnd = FindWindow(MENU_CLASS_NAME, NULL);
- if (hservwnd != NULL) {
- /* We don't allow multiple instances! */
- MessageBox(NULL, _("Another instance of Bacula is already running"), szAppName, MB_OK);
- _exit(0);
- }
-#endif
-
/* Create a thread to handle the Windows messages */
pthread_create(&tid, NULL, Main_Msg_Loop, (void *)0);
UsePrecompiledHeader="0"\r
BrowseInformation="1"\r
WarningLevel="3"\r
- Detect64BitPortabilityProblems="false"\r
SuppressStartupBanner="true"\r
+ Detect64BitPortabilityProblems="false"\r
DebugInformationFormat="4"\r
/>\r
<Tool\r
UsePrecompiledHeader="0"\r
BrowseInformation="1"\r
WarningLevel="3"\r
- Detect64BitPortabilityProblems="false"\r
SuppressStartupBanner="true"\r
+ Detect64BitPortabilityProblems="false"\r
DebugInformationFormat="3"\r
/>\r
<Tool\r
RelativePath="..\..\filed\acl.c"\r
>\r
<FileConfiguration\r
- Name="Release|Win32"\r
+ Name="Debug|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
/>\r
</FileConfiguration>\r
<FileConfiguration\r
- Name="Debug|Win32"\r
+ Name="Release|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
RelativePath="..\..\filed\authenticate.c"\r
>\r
<FileConfiguration\r
- Name="Release|Win32"\r
+ Name="Debug|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
/>\r
</FileConfiguration>\r
<FileConfiguration\r
- Name="Debug|Win32"\r
+ Name="Release|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
RelativePath="..\..\filed\backup.c"\r
>\r
<FileConfiguration\r
- Name="Release|Win32"\r
+ Name="Debug|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
/>\r
</FileConfiguration>\r
<FileConfiguration\r
- Name="Debug|Win32"\r
+ Name="Release|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
RelativePath="..\..\filed\estimate.c"\r
>\r
<FileConfiguration\r
- Name="Release|Win32"\r
+ Name="Debug|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
/>\r
</FileConfiguration>\r
<FileConfiguration\r
- Name="Debug|Win32"\r
+ Name="Release|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
RelativePath="..\..\filed\filed.c"\r
>\r
<FileConfiguration\r
- Name="Release|Win32"\r
+ Name="Debug|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
/>\r
</FileConfiguration>\r
<FileConfiguration\r
- Name="Debug|Win32"\r
+ Name="Release|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
RelativePath="..\..\filed\filed_conf.c"\r
>\r
<FileConfiguration\r
- Name="Release|Win32"\r
+ Name="Debug|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
/>\r
</FileConfiguration>\r
<FileConfiguration\r
- Name="Debug|Win32"\r
+ Name="Release|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
RelativePath="..\..\filed\heartbeat.c"\r
>\r
<FileConfiguration\r
- Name="Release|Win32"\r
+ Name="Debug|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
/>\r
</FileConfiguration>\r
<FileConfiguration\r
- Name="Debug|Win32"\r
+ Name="Release|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
RelativePath="..\..\filed\job.c"\r
>\r
<FileConfiguration\r
- Name="Release|Win32"\r
+ Name="Debug|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
/>\r
</FileConfiguration>\r
<FileConfiguration\r
- Name="Debug|Win32"\r
+ Name="Release|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
RelativePath="..\..\filed\pythonfd.c"\r
>\r
<FileConfiguration\r
- Name="Release|Win32"\r
+ Name="Debug|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
/>\r
</FileConfiguration>\r
<FileConfiguration\r
- Name="Debug|Win32"\r
+ Name="Release|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
RelativePath="..\..\filed\restore.c"\r
>\r
<FileConfiguration\r
- Name="Release|Win32"\r
+ Name="Debug|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
/>\r
</FileConfiguration>\r
<FileConfiguration\r
- Name="Debug|Win32"\r
+ Name="Release|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
RelativePath="..\..\filed\status.c"\r
>\r
<FileConfiguration\r
- Name="Release|Win32"\r
+ Name="Debug|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
/>\r
</FileConfiguration>\r
<FileConfiguration\r
- Name="Debug|Win32"\r
+ Name="Release|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
RelativePath="..\..\filed\verify.c"\r
>\r
<FileConfiguration\r
- Name="Release|Win32"\r
+ Name="Debug|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
/>\r
</FileConfiguration>\r
<FileConfiguration\r
- Name="Debug|Win32"\r
+ Name="Release|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
RelativePath="..\..\filed\verify_vol.c"\r
>\r
<FileConfiguration\r
- Name="Release|Win32"\r
+ Name="Debug|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
/>\r
</FileConfiguration>\r
<FileConfiguration\r
- Name="Debug|Win32"\r
+ Name="Release|Win32"\r
>\r
<Tool\r
Name="VCCLCompilerTool"\r
RelativePath="..\libwin32\winabout.h"\r
>\r
</File>\r
+ <File\r
+ RelativePath="..\libwin32\winbacula.h"\r
+ >\r
+ </File>\r
<File\r
RelativePath="..\compat\winconfig.h"\r
>\r
char *szCmdLine = CmdLine;
char *wordPtr, *tempPtr;
int i, quote;
+ DWORD dwCharsWritten;
/* Save the application instance and main thread id */
hAppInstance = hInstance;
/*
* Now process Windows command line options
*/
- bool argfound = false;
for (i = 0; i < (int)strlen(szCmdLine); i++) {
if (szCmdLine[i] <= ' ') {
continue;
break;
}
- argfound = true;
-
/* Now check for command-line arguments */
/* /silent install quietly -- no prompts */
- if (strnicmp(&szCmdLine[i], "/silent", strlen("/silent")) == 0) {
+ if (strnicmp(&szCmdLine[i], BaculaSilent, sizeof(BaculaSilent) - 1) == 0) {
silent = true;
- i += strlen("/silent");
+ i += sizeof(BaculaSilent) - 1;
continue;
}
/* /service start service */
- if (strnicmp(&szCmdLine[i], BaculaRunService, strlen(BaculaRunService)) == 0) {
+ if (strnicmp(&szCmdLine[i], BaculaRunService, sizeof(BaculaRunService) - 1) == 0) {
/* Run Bacula as a service */
return bacService::BaculaServiceMain();
}
/* /run (this is the default if no command line arguments) */
- if (strnicmp(&szCmdLine[i], BaculaRunAsUserApp, strlen(BaculaRunAsUserApp)) == 0) {
+ if (strnicmp(&szCmdLine[i], BaculaRunAsUserApp, sizeof(BaculaRunAsUserApp) - 1) == 0) {
/* Bacula is being run as a user-level program */
+ if (!AttachConsole(ATTACH_PARENT_PROCESS)) {
+ AllocConsole();
+ }
+ WriteConsole(GetStdHandle(STD_OUTPUT_HANDLE), "\r\n", 2, &dwCharsWritten, NULL);
+
return BaculaAppMain();
}
/* /install */
- if (strnicmp(&szCmdLine[i], BaculaInstallService, strlen(BaculaInstallService)) == 0) {
+ if (strnicmp(&szCmdLine[i], BaculaInstallService, sizeof(BaculaInstallService) - 1) == 0) {
/* Install Bacula as a service */
- bacService::InstallService(&szCmdLine[i + strlen(BaculaInstallService)]);
- i += strlen(BaculaInstallService);
- continue;
+ return bacService::InstallService(&szCmdLine[i + sizeof(BaculaInstallService) - 1]);
}
/* /remove */
- if (strnicmp(&szCmdLine[i], BaculaRemoveService, strlen(BaculaRemoveService)) == 0) {
+ if (strnicmp(&szCmdLine[i], BaculaRemoveService, sizeof(BaculaRemoveService) - 1) == 0) {
/* Remove the Bacula service */
- bacService::RemoveService();
- i += strlen(BaculaRemoveService);
- continue;
+ return bacService::RemoveService();
}
/* /about */
- if (strnicmp(&szCmdLine[i], BaculaShowAbout, strlen(BaculaShowAbout)) == 0) {
+ if (strnicmp(&szCmdLine[i], BaculaShowAbout, sizeof(BaculaShowAbout) - 1) == 0) {
/* Show Bacula's about box */
- bacService::ShowAboutBox();
- i += strlen(BaculaShowAbout);
- continue;
+ return bacService::ShowAboutBox();
}
/* /status */
- if (strnicmp(&szCmdLine[i], BaculaShowStatus, strlen(BaculaShowStatus)) == 0) {
+ if (strnicmp(&szCmdLine[i], BaculaShowStatus, sizeof(BaculaShowStatus) - 1) == 0) {
/* Show Bacula's status box */
- bacService::ShowStatus();
- i += strlen(BaculaShowStatus);
- continue;
+ return bacService::ShowStatus();
}
/* /kill */
- if (strnicmp(&szCmdLine[i], BaculaKillRunningCopy, strlen(BaculaKillRunningCopy)) == 0) {
+ if (strnicmp(&szCmdLine[i], BaculaKillRunningCopy, sizeof(BaculaKillRunningCopy) - 1) == 0) {
/* Kill running copy of Bacula */
- bacService::KillRunningCopy();
- i += strlen(BaculaKillRunningCopy);
- continue;
+ return bacService::KillRunningCopy();
}
/* /help */
- if (strnicmp(&szCmdLine[i], BaculaShowHelp, strlen(BaculaShowHelp)) == 0) {
+ if (strnicmp(&szCmdLine[i], BaculaShowHelp, sizeof(BaculaShowHelp) - 1) == 0) {
MessageBox(NULL, BaculaUsageText, _("Bacula Usage"), MB_OK|MB_ICONINFORMATION);
- i += strlen(BaculaShowHelp);
- continue;
+ return 0;
}
MessageBox(NULL, szCmdLine, _("Bad Command Line Options"), MB_OK);
/* Show the usage dialog */
MessageBox(NULL, BaculaUsageText, _("Bacula Usage"), MB_OK | MB_ICONINFORMATION);
- break;
+
+ return 1;
}
/* If no arguments were given then just run */
- if (!argfound) {
- BaculaAppMain();
+ if (!AttachConsole(ATTACH_PARENT_PROCESS)) {
+ AllocConsole();
}
- return 0;
+ WriteConsole(GetStdHandle(STD_OUTPUT_HANDLE), "\r\n", 2, &dwCharsWritten, NULL);
+
+ return BaculaAppMain();
}
#
# Define the main nightly save backup job
-# By default, this job will back up to disk in /tmp
+# By default, this job will back up to disk in C:/tmp
Job {
Name = "Client1"
JobDefs = "DefaultJob"
#Job {
# Name = "Client2"
-# Client = @client_address@2-fd
+# Client = @client_name@2
# JobDefs = "DefaultJob"
# Write Bootstrap = "@working_dir@\\Client2.bsr"
#}
FileSet="Catalog"
Schedule = "WeeklyCycleAfterBackup"
# This creates an ASCII copy of the catalog
- RunBeforeJob = "@bin_dir@\\make_catalog_backup bacula bacula"
+ RunBeforeJob = "\"@bin_dir@\\make_catalog_backup\" bacula bacula"
# This deletes the copy of the catalog
- RunAfterJob = "@bin_dir@\\delete_catalog_backup"
+ RunAfterJob = "\"@bin_dir@\\delete_catalog_backup\""
Write Bootstrap = "@working_dir@\\BackupCatalog.bsr"
Priority = 11 # run after main backup
}
Storage = File
Pool = Default
Messages = Standard
- Where = /tmp/bacula-restores
+ Where = C:\\tmp\\bacula-restores
}
# Definition of file storage device
Storage {
Name = File
-# Do not use "localhost" here
+# Do not use "localhost" here
Address = @storage_address@ # N.B. Use a fully qualified name here
SDPort = @storage_port@
Password = "@storage_password@"
# MediaType = "8mm"
#}
-# Definition of DVD storage device
-#Storage {
-# Name = "DVD"
-# Do not use "localhost" here
-# Address = @storage_address@ # N.B. Use a fully qualified name here
-# SDPort = @storage_port@
-# Password = "@storage_password@"
-# Device = "DVD Writer"
-# MediaType = "DVD"
-#}
-
# Generic catalog service
Catalog {
# to replace the %r in the from field (-f part) with a single valid
# email address in both the mailcommand and the operatorcommand.
#
- mailcommand = "@bin_dir@\\bsmtp -h @smtp_host@ -f \"\(Bacula\) %r\" -s \"Bacula: %t %e of %c %l\" %r"
- operatorcommand = "@bin_dir@\\bsmtp -h @smtp_host@ -f \"\(Bacula\) %r\" -s \"Bacula: Intervention needed for %j\" %r"
+ mailcommand = "\"@bin_dir@\\bsmtp\" -h @smtp_host@ -f \"\(Bacula\) %r\" -s \"Bacula: %t %e of %c %l\" %r"
+ operatorcommand = "\"@bin_dir@\\bsmtp\" -h @smtp_host@ -f \"\(Bacula\) %r\" -s \"Bacula: Intervention needed for %j\" %r"
mail = @job_email@ = all, !skipped
operator = @job_email@ = mount
console = all, !skipped, !saved
# Message delivery for daemon messages (no job).
Messages {
Name = Daemon
- mailcommand = "@bin_dir@\\bsmtp -h @smtp_host@ -f \"\(Bacula\) %r\" -s \"Bacula daemon message\" %r"
+ mailcommand = "\"@bin_dir@\\bsmtp\" -h @smtp_host@ -f \"\(Bacula\) %r\" -s \"Bacula daemon message\" %r"
mail = @job_email@ = all, !skipped
console = all, !skipped, !saved
append = "@working_dir@\\log" = all, !skipped
File "${DEPKGS_BIN}\pthreadVCE.dll"
!endif
!if "${BUILD_TOOLS}" == "VC8_DEBUG"
+ File "${VC_REDIST_DIR}\msvcm80.dll"
+ File "${VC_REDIST_DIR}\msvcp80.dll"
+ File "${VC_REDIST_DIR}\msvcr80.dll"
+ File "${VC_REDIST_DIR}\Microsoft.VC80.CRT.manifest"
File "${VC_REDIST_DIR}\msvcm80d.dll"
File "${VC_REDIST_DIR}\msvcp80d.dll"
File "${VC_REDIST_DIR}\msvcr80d.dll"
File "${DEPKGS_BIN}\zlib1.dll"
!if "${BUILD_TOOLS}" == "VC8"
File "${DEPKGS_BIN}\zlib1.dll.manifest"
+ File "/oname=$INSTDIR\openssl.cnf" "${DEPKGS_BIN}\..\openssl.cnf"
!endif
!If "${BUILD_TOOLS}" == "VC8_DEBUG"
File "${DEPKGS_BIN}\zlib1.dll.manifest"
+ File "/oname=$INSTDIR\openssl.cnf" "${DEPKGS_BIN}\..\openssl.cnf"
+!endif
+!if "${BUILD_TOOLS}" == "MinGW"
+ File "/oname=$INSTDIR\openssl.cnf" "${DEPKGS_BIN}\..\ssl\openssl.cnf"
!endif
File "${DEPKGS_BIN}\openssl.exe"
File "${BACULA_BIN}\bsleep.exe"
extern void LogErrorMsg(char *msg);
// Standard command-line flag definitions
+const char BaculaSilent[] = "/silent";
+
const char BaculaRunService[] = "/service";
-const char BaculaRunServiceHelper[] = "/servicehelper";
const char BaculaRunAsUserApp[] = "/run";
+const char BaculaKillRunningCopy[] = "/kill";
const char BaculaInstallService[] = "/install";
const char BaculaRemoveService[] = "/remove";
const char BaculaShowAbout[] = "/about";
const char BaculaShowStatus[] = "/status";
-const char BaculaShowEvents[] = "/events";
-const char BaculaKillRunningCopy[] = "/kill";
const char BaculaShowHelp[] = "/help";
// Usage string
-const char BaculaUsageText[] = "Bacula [/run] [/kill] [/install] [/remove] [/about] [/status] [/events]\n";
+const char BaculaUsageText[] = "Bacula [/silent] [/service] [/run] [/kill] [/install] [/remove] [/about] [/status] [/help]\n";
void LogErrorMsg(char *msg, char *fname, int lineno);
#define log_error_message(msg) LogErrorMsg((msg), __FILE__, __LINE__)
extern void LogErrorMsg(char *msg);
// Standard command-line flag definitions
+const char BaculaSilent[] = "/silent";
+
const char BaculaRunService[] = "/service";
-const char BaculaRunServiceHelper[] = "/servicehelper";
const char BaculaRunAsUserApp[] = "/run";
+const char BaculaKillRunningCopy[] = "/kill";
const char BaculaInstallService[] = "/install";
const char BaculaRemoveService[] = "/remove";
const char BaculaShowAbout[] = "/about";
const char BaculaShowStatus[] = "/status";
-const char BaculaShowEvents[] = "/events";
-const char BaculaKillRunningCopy[] = "/kill";
const char BaculaShowHelp[] = "/help";
// Usage string
-const char BaculaUsageText[] = "Bacula [/run] [/kill] [/install] [/remove] [/about] [/status] [/events]\n";
+const char BaculaUsageText[] = "Bacula [/silent] [/service] [/run] [/kill] [/install] [/remove] [/about] [/status] [/help]\n";
void LogErrorMsg(char *msg, char *fname, int lineno);
#define log_error_message(msg) LogErrorMsg((msg), __FILE__, __LINE__)
char *szCmdLine = CmdLine;
char *wordPtr, *tempPtr;
int i, quote;
+ DWORD dwCharsWritten;
/* Save the application instance and main thread id */
hAppInstance = hInstance;
if (*szCmdLine != '"' && *wordPtr == '"') {
szCmdLine = wordPtr + 1;
}
-// MessageBox(NULL, szCmdLine, "Cmdline", MB_OK);
/* Build Unix style argc *argv[] */
/*
* Now process Windows command line options
*/
- bool argfound = false;
for (i = 0; i < (int)strlen(szCmdLine); i++) {
if (szCmdLine[i] <= ' ') {
continue;
break;
}
- argfound = true;
-
/* Now check for command-line arguments */
/* /silent install quietly -- no prompts */
- if (strnicmp(&szCmdLine[i], "/silent", strlen("/silent")) == 0) {
+ if (strnicmp(&szCmdLine[i], BaculaSilent, sizeof(BaculaSilent) - 1) == 0) {
silent = true;
- i += strlen("/silent");
+ i += sizeof(BaculaSilent) - 1;
continue;
}
/* /service start service */
- if (strnicmp(&szCmdLine[i], BaculaRunService, strlen(BaculaRunService)) == 0) {
+ if (strnicmp(&szCmdLine[i], BaculaRunService, sizeof(BaculaRunService) - 1) == 0) {
/* Run Bacula as a service */
return bacService::BaculaServiceMain();
}
/* /run (this is the default if no command line arguments) */
- if (strnicmp(&szCmdLine[i], BaculaRunAsUserApp, strlen(BaculaRunAsUserApp)) == 0) {
+ if (strnicmp(&szCmdLine[i], BaculaRunAsUserApp, sizeof(BaculaRunAsUserApp) - 1) == 0) {
/* Bacula is being run as a user-level program */
+ if (!AttachConsole(ATTACH_PARENT_PROCESS)) {
+ AllocConsole();
+ }
+ WriteConsole(GetStdHandle(STD_OUTPUT_HANDLE), "\r\n", 2, &dwCharsWritten, NULL);
+
return BaculaAppMain();
}
/* /install */
- if (strnicmp(&szCmdLine[i], BaculaInstallService, strlen(BaculaInstallService)) == 0) {
+ if (strnicmp(&szCmdLine[i], BaculaInstallService, sizeof(BaculaInstallService) - 1) == 0) {
/* Install Bacula as a service */
- bacService::InstallService(&szCmdLine[i + strlen(BaculaInstallService)]);
- i += strlen(BaculaInstallService);
- continue;
+ return bacService::InstallService(&szCmdLine[i + sizeof(BaculaInstallService) - 1]);
}
/* /remove */
- if (strnicmp(&szCmdLine[i], BaculaRemoveService, strlen(BaculaRemoveService)) == 0) {
+ if (strnicmp(&szCmdLine[i], BaculaRemoveService, sizeof(BaculaRemoveService) - 1) == 0) {
/* Remove the Bacula service */
- bacService::RemoveService();
- i += strlen(BaculaRemoveService);
- continue;
+ return bacService::RemoveService();
}
/* /about */
- if (strnicmp(&szCmdLine[i], BaculaShowAbout, strlen(BaculaShowAbout)) == 0) {
+ if (strnicmp(&szCmdLine[i], BaculaShowAbout, sizeof(BaculaShowAbout) - 1) == 0) {
/* Show Bacula's about box */
- bacService::ShowAboutBox();
- i += strlen(BaculaShowAbout);
- continue;
+ return bacService::ShowAboutBox();
}
/* /status */
- if (strnicmp(&szCmdLine[i], BaculaShowStatus, strlen(BaculaShowStatus)) == 0) {
+ if (strnicmp(&szCmdLine[i], BaculaShowStatus, sizeof(BaculaShowStatus) - 1) == 0) {
/* Show Bacula's status box */
- bacService::ShowStatus();
- i += strlen(BaculaShowStatus);
- continue;
+ return bacService::ShowStatus();
}
/* /kill */
- if (strnicmp(&szCmdLine[i], BaculaKillRunningCopy, strlen(BaculaKillRunningCopy)) == 0) {
+ if (strnicmp(&szCmdLine[i], BaculaKillRunningCopy, sizeof(BaculaKillRunningCopy) - 1) == 0) {
/* Kill running copy of Bacula */
- bacService::KillRunningCopy();
- i += strlen(BaculaKillRunningCopy);
- continue;
+ return bacService::KillRunningCopy();
}
/* /help */
- if (strnicmp(&szCmdLine[i], BaculaShowHelp, strlen(BaculaShowHelp)) == 0) {
+ if (strnicmp(&szCmdLine[i], BaculaShowHelp, sizeof(BaculaShowHelp) - 1) == 0) {
MessageBox(NULL, BaculaUsageText, _("Bacula Usage"), MB_OK|MB_ICONINFORMATION);
- i += strlen(BaculaShowHelp);
- continue;
+ return 0;
}
MessageBox(NULL, szCmdLine, _("Bad Command Line Options"), MB_OK);
/* Show the usage dialog */
MessageBox(NULL, BaculaUsageText, _("Bacula Usage"), MB_OK | MB_ICONINFORMATION);
- break;
+ return 1;
}
/* If no arguments were given then just run */
- if (!argfound) {
- BaculaAppMain();
+ if (!AttachConsole(ATTACH_PARENT_PROCESS)) {
+ AllocConsole();
}
- return 0;
+ WriteConsole(GetStdHandle(STD_OUTPUT_HANDLE), "\r\n", 2, &dwCharsWritten, NULL);
+
+ return BaculaAppMain();
}