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
c218ade5
Commit
c218ade5
authored
7 years ago
by
Niko Ehrenfeuchter
Browse files
Options
Downloads
Patches
Plain Diff
Make CheckFreeDiskSpace static and move to ATXCommon.SystemChecks.
parent
479f8edc
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
ATXCommon/SystemChecks.cs
+19
-0
19 additions, 0 deletions
ATXCommon/SystemChecks.cs
AutoTx/AutoTx.cs
+1
-1
1 addition, 1 deletion
AutoTx/AutoTx.cs
AutoTx/Email.cs
+3
-0
3 additions, 0 deletions
AutoTx/Email.cs
AutoTx/SystemChecks.cs
+0
-18
0 additions, 18 deletions
AutoTx/SystemChecks.cs
with
23 additions
and
19 deletions
ATXCommon/SystemChecks.cs
+
19
−
0
View file @
c218ade5
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.IO
;
using
System.IO
;
using
System.Linq
;
using
System.Linq
;
using
System.Management
;
using
System.Management
;
...
@@ -66,6 +67,24 @@ namespace ATXCommon
...
@@ -66,6 +67,24 @@ namespace ATXCommon
return
0
;
return
0
;
}
}
/// <summary>
/// Check all configured disks for their free space and send a notification
/// if necessary (depending on the configured delta time).
/// </summary>
public
static
string
CheckFreeDiskSpace
(
List
<
Serializables
.
DriveToCheck
>
drives
)
{
var
msg
=
""
;
foreach
(
var
driveToCheck
in
drives
)
{
var
freeSpace
=
SystemChecks
.
GetFreeDriveSpace
(
driveToCheck
.
DriveName
);
if
(
freeSpace
>=
driveToCheck
.
SpaceThreshold
)
continue
;
msg
+=
"Drive '"
+
driveToCheck
.
DriveName
+
"' - free space: "
+
freeSpace
+
" (threshold: "
+
driveToCheck
.
SpaceThreshold
+
")\n"
;
}
return
msg
;
}
/// <summary>
/// <summary>
/// Check if a user is currently logged into Windows.
/// Check if a user is currently logged into Windows.
///
///
...
...
This diff is collapsed.
Click to expand it.
AutoTx/AutoTx.cs
+
1
−
1
View file @
c218ade5
...
@@ -485,7 +485,7 @@ namespace AutoTx
...
@@ -485,7 +485,7 @@ namespace AutoTx
/// </summary>
/// </summary>
public
void
RunMainTasks
()
{
public
void
RunMainTasks
()
{
// mandatory tasks, run on every call:
// mandatory tasks, run on every call:
CheckFreeDiskSpace
(
);
SendLowSpaceMail
(
SystemChecks
.
CheckFreeDiskSpace
(
_config
.
SpaceMonitoring
)
);
UpdateServiceState
();
UpdateServiceState
();
var
delta
=
(
int
)(
DateTime
.
Now
-
_lastUserDirCheck
).
TotalSeconds
;
var
delta
=
(
int
)(
DateTime
.
Now
-
_lastUserDirCheck
).
TotalSeconds
;
...
...
This diff is collapsed.
Click to expand it.
AutoTx/Email.cs
+
3
−
0
View file @
c218ade5
...
@@ -106,6 +106,9 @@ namespace AutoTx
...
@@ -106,6 +106,9 @@ namespace AutoTx
/// </summary>
/// </summary>
/// <param name="spaceDetails">String describing the drives being low on space.</param>
/// <param name="spaceDetails">String describing the drives being low on space.</param>
public
void
SendLowSpaceMail
(
string
spaceDetails
)
{
public
void
SendLowSpaceMail
(
string
spaceDetails
)
{
if
(
string
.
IsNullOrWhiteSpace
(
spaceDetails
))
return
;
var
delta
=
(
int
)(
DateTime
.
Now
-
_status
.
LastStorageNotification
).
TotalMinutes
;
var
delta
=
(
int
)(
DateTime
.
Now
-
_status
.
LastStorageNotification
).
TotalMinutes
;
if
(
delta
<
_config
.
StorageNotificationDelta
)
if
(
delta
<
_config
.
StorageNotificationDelta
)
return
;
return
;
...
...
This diff is collapsed.
Click to expand it.
AutoTx/SystemChecks.cs
+
0
−
18
View file @
c218ade5
...
@@ -6,24 +6,6 @@ namespace AutoTx
...
@@ -6,24 +6,6 @@ namespace AutoTx
{
{
public
partial
class
AutoTx
public
partial
class
AutoTx
{
{
/// <summary>
/// Check all configured disks for their free space and send a notification
/// if necessary (depending on the configured delta time).
/// </summary>
public
void
CheckFreeDiskSpace
()
{
var
msg
=
""
;
foreach
(
var
driveToCheck
in
_config
.
SpaceMonitoring
)
{
var
freeSpace
=
SystemChecks
.
GetFreeDriveSpace
(
driveToCheck
.
DriveName
);
if
(
freeSpace
>=
driveToCheck
.
SpaceThreshold
)
continue
;
msg
+=
"Drive '"
+
driveToCheck
.
DriveName
+
"' - free space: "
+
freeSpace
+
" (threshold: "
+
driveToCheck
.
SpaceThreshold
+
")\n"
;
}
if
(
msg
!=
""
)
SendLowSpaceMail
(
msg
);
}
/// <summary>
/// <summary>
/// Compares all processes against the ProcessNames in the BlacklistedProcesses list.
/// Compares all processes against the ProcessNames in the BlacklistedProcesses list.
/// </summary>
/// </summary>
...
...
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