Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
auto-tx
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
vamp
auto-tx
Commits
3a1b6b1b
Commit
3a1b6b1b
authored
7 years ago
by
Niko Ehrenfeuchter
Browse files
Options
Downloads
Patches
Plain Diff
Move generation of config and status summaries into their respective classes.
parent
51a4f062
No related branches found
Branches containing commit
Tags
1.2
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
AutoTx/AutoTx.cs
+18
-55
18 additions, 55 deletions
AutoTx/AutoTx.cs
AutoTx/XmlWrapper/ServiceConfig.cs
+36
-0
36 additions, 0 deletions
AutoTx/XmlWrapper/ServiceConfig.cs
AutoTx/XmlWrapper/ServiceStatus.cs
+14
-0
14 additions, 0 deletions
AutoTx/XmlWrapper/ServiceStatus.cs
with
68 additions
and
55 deletions
AutoTx/AutoTx.cs
+
18
−
55
View file @
3a1b6b1b
...
...
@@ -190,68 +190,31 @@ namespace AutoTx
/// Write a summary of loaded config + status to the log.
/// </summary>
private
void
StartupSummary
()
{
writeLogDebug
(
"
------ RoboSharp ------"
)
;
var
msg
=
"\n\n
------ RoboSharp ------
\n
"
;
var
roboDll
=
System
.
Reflection
.
Assembly
.
GetAssembly
(
typeof
(
RoboCommand
)).
Location
;
if
(
roboDll
!=
null
)
{
var
versionInfo
=
FileVersionInfo
.
GetVersionInfo
(
roboDll
);
writeLogDebug
(
" > DLL file: "
+
roboDll
);
writeLogDebug
(
" > DLL description: "
+
versionInfo
.
Comments
);
writeLogDebug
(
" > DLL version: "
+
versionInfo
.
FileVersion
);
}
writeLogDebug
(
""
);
writeLogDebug
(
"------ Loaded status flags ------"
);
writeLogDebug
(
"CurrentTransferSrc: "
+
_status
.
CurrentTransferSrc
);
writeLogDebug
(
"CurrentTargetTmp: "
+
_status
.
CurrentTargetTmp
);
writeLogDebug
(
"TransferInProgress: "
+
_status
.
TransferInProgress
);
writeLogDebug
(
"LastStorageNotification: "
+
_status
.
LastStorageNotification
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
));
writeLogDebug
(
"LastAdminNotification: "
+
_status
.
LastAdminNotification
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
));
writeLogDebug
(
""
);
writeLogDebug
(
"------ Loaded configuration settings ------"
);
writeLogDebug
(
"HostAlias: "
+
_config
.
HostAlias
);
writeLogDebug
(
"SourceDrive: "
+
_config
.
SourceDrive
);
writeLogDebug
(
"IncomingDirectory: "
+
_config
.
IncomingDirectory
);
writeLogDebug
(
"MarkerFile: "
+
_config
.
MarkerFile
);
writeLogDebug
(
"ManagedDirectory: "
+
_config
.
ManagedDirectory
);
writeLogDebug
(
"GracePeriod: "
+
_config
.
GracePeriod
);
writeLogDebug
(
"DestinationDirectory: "
+
_config
.
DestinationDirectory
);
writeLogDebug
(
"TmpTransferDir: "
+
_config
.
TmpTransferDir
);
writeLogDebug
(
"EnforceInheritedACLs: "
+
_config
.
EnforceInheritedACLs
);
writeLogDebug
(
"ServiceTimer: "
+
_config
.
ServiceTimer
);
writeLogDebug
(
"InterPacketGap: "
+
_config
.
InterPacketGap
);
writeLogDebug
(
"MaxCpuUsage: "
+
_config
.
MaxCpuUsage
);
writeLogDebug
(
"MinAvailableMemory: "
+
_config
.
MinAvailableMemory
);
foreach
(
var
processName
in
_config
.
BlacklistedProcesses
)
{
writeLogDebug
(
"BlacklistedProcess: "
+
processName
);
msg
+=
" > DLL file: "
+
roboDll
+
"\n"
+
" > DLL description: "
+
versionInfo
.
Comments
+
"\n"
+
" > DLL version: "
+
versionInfo
.
FileVersion
+
"\n"
;
}
foreach
(
var
driveToCheck
in
_config
.
SpaceMonitoring
)
{
writeLogDebug
(
"Drive to check free space: "
+
driveToCheck
.
DriveName
+
" (threshold: "
+
driveToCheck
.
SpaceThreshold
+
")"
);
}
writeLogDebug
(
"StorageNotificationDelta: "
+
_config
.
StorageNotificationDelta
);
writeLogDebug
(
"AdminNotificationDelta: "
+
_config
.
AdminNotificationDelta
);
if
(
string
.
IsNullOrEmpty
(
_config
.
SmtpHost
))
{
writeLogDebug
(
"SmtpHost: ====== Not configured, disabling notification emails! ======"
);
}
else
{
writeLogDebug
(
"SmtpHost: "
+
_config
.
SmtpHost
);
writeLogDebug
(
"EmailFrom: "
+
_config
.
EmailFrom
);
writeLogDebug
(
"AdminEmailAdress: "
+
_config
.
AdminEmailAdress
);
writeLogDebug
(
"AdminDebugEmailAdress: "
+
_config
.
AdminDebugEmailAdress
);
}
writeLogDebug
(
""
);
writeLogDebug
(
msg
);
// finally some current information:
writeLogDebug
(
"------ Current system parameters ------"
);
writeLogDebug
(
"Hostname: "
+
Environment
.
MachineName
);
writeLogDebug
(
"Free system memory: "
+
GetFreeMemory
()
+
" MB"
);
msg
=
"\n\n------ Loaded status flags ------\n"
+
_status
.
Summary
()
+
"\n------ Loaded configuration settings ------\n"
+
_config
.
Summary
();
writeLogDebug
(
msg
);
msg
=
"\n\n------ Current system parameters ------\n"
+
"Hostname: "
+
Environment
.
MachineName
+
"\n"
+
"Free system memory: "
+
GetFreeMemory
()
+
" MB"
+
"\n"
;
foreach
(
var
driveToCheck
in
_config
.
SpaceMonitoring
)
{
writeLogDebug
(
"Free space on drive '"
+
driveToCheck
.
DriveName
+
"': "
+
GetFreeDriveSpace
(
driveToCheck
.
DriveName
)
)
;
msg
+=
"Free space on drive '"
+
driveToCheck
.
DriveName
+
"': "
+
GetFreeDriveSpace
(
driveToCheck
.
DriveName
)
+
"\n"
;
}
writeLogDebug
(
""
);
writeLogDebug
(
msg
);
writeLogDebug
(
"------ Grace location status ------"
);
try
{
...
...
This diff is collapsed.
Click to expand it.
AutoTx/XmlWrapper/ServiceConfig.cs
+
36
−
0
View file @
3a1b6b1b
...
...
@@ -181,5 +181,41 @@ namespace AutoTx.XmlWrapper
c
.
ValidationWarnings
+=
" - <DestinationDirectory> is not a UNC path!\n"
;
}
public
string
Summary
()
{
var
msg
=
"HostAlias: "
+
HostAlias
+
"\n"
+
"SourceDrive: "
+
SourceDrive
+
"\n"
+
"IncomingDirectory: "
+
IncomingDirectory
+
"\n"
+
"MarkerFile: "
+
MarkerFile
+
"\n"
+
"ManagedDirectory: "
+
ManagedDirectory
+
"\n"
+
"GracePeriod: "
+
GracePeriod
+
"\n"
+
"DestinationDirectory: "
+
DestinationDirectory
+
"\n"
+
"TmpTransferDir: "
+
TmpTransferDir
+
"\n"
+
"EnforceInheritedACLs: "
+
EnforceInheritedACLs
+
"\n"
+
"ServiceTimer: "
+
ServiceTimer
+
"\n"
+
"InterPacketGap: "
+
InterPacketGap
+
"\n"
+
"MaxCpuUsage: "
+
MaxCpuUsage
+
"\n"
+
"MinAvailableMemory: "
+
MinAvailableMemory
+
"\n"
;
foreach
(
var
processName
in
BlacklistedProcesses
)
{
msg
+=
"BlacklistedProcess: "
+
processName
+
"\n"
;
}
foreach
(
var
driveToCheck
in
SpaceMonitoring
)
{
msg
+=
"Drive to check free space: "
+
driveToCheck
.
DriveName
+
" (threshold: "
+
driveToCheck
.
SpaceThreshold
+
")"
+
"\n"
;
}
if
(
string
.
IsNullOrEmpty
(
SmtpHost
))
{
msg
+=
"SmtpHost: ====== Not configured, disabling email! ======"
+
"\n"
;
}
else
{
msg
+=
"SmtpHost: "
+
SmtpHost
+
"\n"
+
"EmailFrom: "
+
EmailFrom
+
"\n"
+
"AdminEmailAdress: "
+
AdminEmailAdress
+
"\n"
+
"AdminDebugEmailAdress: "
+
AdminDebugEmailAdress
+
"\n"
+
"StorageNotificationDelta: "
+
StorageNotificationDelta
+
"\n"
+
"AdminNotificationDelta: "
+
AdminNotificationDelta
+
"\n"
;
}
return
msg
;
}
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
AutoTx/XmlWrapper/ServiceStatus.cs
+
14
−
0
View file @
3a1b6b1b
...
...
@@ -197,5 +197,19 @@ namespace AutoTx.XmlWrapper
}
}
public
string
Summary
()
{
return
"CurrentTransferSrc: "
+
CurrentTransferSrc
+
"\n"
+
"CurrentTargetTmp: "
+
CurrentTargetTmp
+
"\n"
+
"TransferInProgress: "
+
TransferInProgress
+
"\n"
+
"CurrentTransferSize: "
+
CurrentTransferSize
+
"\n"
+
"LastStatusUpdate: "
+
LastStatusUpdate
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)
+
"\n"
+
"LastStorageNotification: "
+
LastStorageNotification
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)
+
"\n"
+
"LastAdminNotification: "
+
LastAdminNotification
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)
+
"\n"
;
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment