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
a7dac81c
Commit
a7dac81c
authored
7 years ago
by
Niko Ehrenfeuchter
Browse files
Options
Downloads
Patches
Plain Diff
Add SendTransferInterruptedMail.
Fixes
#8
parent
59cc0407
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
AutoTx/AutoTx.cs
+1
-1
1 addition, 1 deletion
AutoTx/AutoTx.cs
AutoTx/Email.cs
+28
-0
28 additions, 0 deletions
AutoTx/Email.cs
AutoTx/Resources/Mail-Templates/Transfer-Interrupted.txt
+15
-0
15 additions, 0 deletions
AutoTx/Resources/Mail-Templates/Transfer-Interrupted.txt
with
44 additions
and
1 deletion
AutoTx/AutoTx.cs
+
1
−
1
View file @
a7dac81c
...
...
@@ -342,7 +342,7 @@ namespace AutoTx
writeLog
(
"Not all files were transferred - will resume upon next start"
);
writeLogDebug
(
"CurrentTransferSrc: "
+
_status
.
CurrentTransferSrc
);
// should we delete an incompletely transferred file on the target?
// TODO: send a notification to the user of the interrupted transfer (#38)
SendTransferInterruptedMail
();
}
// set the shutdown status to clean:
_status
.
CleanShutdown
=
true
;
...
...
This diff is collapsed.
Click to expand it.
AutoTx/Email.cs
+
28
−
0
View file @
a7dac81c
...
...
@@ -153,5 +153,33 @@ namespace AutoTx
writeLog
(
"Error loading email template: "
+
ex
.
Message
,
true
);
}
}
/// <summary>
/// Send a notification email when a transfer has been interrupted before completion.
/// Recipient address is derived from the global variable CurrentTransferSrc.
/// </summary>
public
void
SendTransferInterruptedMail
()
{
if
(
_config
.
SendTransferNotification
==
false
)
return
;
var
userDir
=
new
DirectoryInfo
(
_status
.
CurrentTransferSrc
).
Name
;
var
substitutions
=
new
List
<
Tuple
<
string
,
string
>>
{
Tuple
.
Create
(
"FACILITY_USER"
,
GetFullUserName
(
userDir
)),
Tuple
.
Create
(
"HOST_ALIAS"
,
_config
.
HostAlias
),
Tuple
.
Create
(
"HOST_NAME"
,
Environment
.
MachineName
),
Tuple
.
Create
(
"EMAIL_FROM"
,
_config
.
EmailFrom
)
};
try
{
var
body
=
LoadMailTemplate
(
"Transfer-Interrupted.txt"
,
substitutions
);
SendEmail
(
GetEmailAddress
(
userDir
),
ServiceName
+
" - Transfer Interrupted - "
+
_config
.
HostAlias
,
body
);
}
catch
(
Exception
ex
)
{
writeLog
(
"Error loading email template: "
+
ex
.
Message
,
true
);
}
}
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
AutoTx/Resources/Mail-Templates/Transfer-Interrupted.txt
0 → 100644
+
15
−
0
View file @
a7dac81c
Dear FACILITY_USER,
unfortunately the transfer service on "HOST_ALIAS" (HOST_NAME)
has been stopped while one of your transfers was still running, probably
due the computer being shut down.
Your transfer will resume without any additional action required once the
service is started again, which happens automatically when the computer has
finished booting up again.
Don't hesitate to contact EMAIL_FROM if you have any additional question.
Have a nice day
The Facility Team
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