* Wrote the man page for anvil-download-file, and updated it to use the new switch method. Changed it's default download directory from /mnt/shared/temp to /mnt/shared/incoming.

* Added the new man pages to the Makefile.am file.

Signed-off-by: digimer <mkelly@alteeve.ca>
main
digimer 1 year ago
parent 75fcad75af
commit 1667d1f132
  1. 2
      man/Makefile.am
  2. 5
      man/anvil-daemon.8
  3. 50
      man/anvil-download-file.8
  4. 2
      man/anvil-manage-alerts.8
  5. 29
      tools/anvil-download-file

@ -12,8 +12,10 @@ dist_man8_MANS = \
anvil-change-password.8 \
anvil-check-memory.8 \
anvil-configure-host.8 \
anvil-cycle-vm-nics.8 \
anvil-daemon.8 \
anvil-delete-server.8 \
anvil-download-file.8 \
anvil-manage-alerts.8 \
anvil-manage-dr.8 \
anvil-manage-files.8 \

@ -1,6 +1,6 @@
.\" Manpage for the Anvil! daemon.
.\" Contact mkelly@alteeve.com to report issues, concerns or suggestions.
.TH anvil-daemon "8" "July 29 2022" "Anvil! Intelligent Availability™ Platform"
.TH anvil-daemon "8" "July 26 2023" "Anvil! Intelligent Availability™ Platform"
.SH NAME
anvil-daemon \- Main systemd daemon for the M3 Anvil! IA cluster. Provides all job management, monitoring and Striker back-end functions.
.SH SYNOPSIS
@ -20,9 +20,6 @@ When logging, record sensitive data, like passwords.
Set the log level to 1, 2 or 3 respectively. Be aware that level 3 generates a significant amount of log data.
.SS "Commands:"
.TP
\fB\-\-refresh\-json\fR (derecated)
Short hand for '\fB\-\-run-once\fR', '\fB\-\-main-loop-only\fR' and '\fB\-\-no-start\fR'. Used to be use to refresh the JSON file used by striker's web interface to know hardware states.
.TP
\fB\-\-main\-loop\-only\fR
This skips the one-time, start-up tasks and just goes into the main-loop.
.TP

@ -0,0 +1,50 @@
.\" Manpage for the Anvil! tool to
.\" Contact mkelly@alteeve.com to report issues, concerns or suggestions.
.TH anvil-download-file "8" "July 26 2023" "Anvil! Intelligent Availability™ Platform"
.SH NAME
anvil-download-file \- This program downloads a file from a URL
.SH SYNOPSIS
.B anvil-download-file
\fI\,<options> \/\fR
.SH DESCRIPTION
This takes a URL (ftp, http or https) and downloads the file. If it is called without --url, it shows the progress of any other instances currently downloading files.
.TP
.SH NOTE
This tool is not complete and should not be used yet
.TP
.SH OPTIONS
.TP
\-?, \-h, \fB\-\-help\fR
Show this man page.
.TP
\fB\-\-log-secure\fR
When logging, record sensitive data, like passwords.
.TP
\-v, \-vv, \-vvv
Set the log level to 1, 2 or 3 respectively. Be aware that level 3 generates a significant amount of log data.
.SS "Commands:"
.TP
\fB\-\-abort\fR (to be implemented)
.TP
Abort an active download.
.TP
\fB\-\-overwrite\fR
.TP
If the file exists already, this switch will overwrite the existing file with the new download.
.TP
\fB\-\-save\-to\fR </path/to/download/directory>
.TP
By default, downloaded files are saved in /mnt/shared/files (copied there after downloading to /mnt/shared/incoming). If you would like to save the downloaded file elsewhere, you can use this switch
.TP
\fB\-\-script\fR
.TP
If this is used, the file being downloaded will be set to be executable.
.TP
\fB\-\-url\fR
.TP
This is the ftp://, http:// or https:// path to the file to be downloaded
.IP
.SH AUTHOR
Written by Madison Kelly, Alteeve staff and the Anvil! project contributors.
.SH "REPORTING BUGS"
Report bugs to users@clusterlabs.org

@ -148,7 +148,7 @@ Valid values are:
.TP
\fB\-\-test\fR
Tells the program to send a test alert at the desired \fB\-\-level\fR. The requested level is required.
.TP
.IP
.SH AUTHOR
Written by Madison Kelly, Alteeve staff and the Anvil! project contributors.
.SH "REPORTING BUGS"

@ -43,6 +43,15 @@ if (($running_directory =~ /^\./) && ($ENV{PWD}))
my $anvil = Anvil::Tools->new();
$anvil->Get->switches({list => [
"abort",
"job-uuid",
"overwrite",
"save-to",
"script",
"url",], man => $THIS_FILE});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => $anvil->data->{switches}});
$anvil->Database->connect;
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 3, secure => 0, key => "log_0132"});
if (not $anvil->data->{sys}{database}{connections})
@ -52,22 +61,6 @@ if (not $anvil->data->{sys}{database}{connections})
$anvil->nice_exit({exit_code => 1});
}
$anvil->data->{switches}{abort} = "";
$anvil->data->{switches}{'job-uuid'} = "";
$anvil->data->{switches}{overwrite} = "";
$anvil->data->{switches}{'save-to'} = ""; # /mnt/shared/files by default
$anvil->data->{switches}{script} = "";
$anvil->data->{switches}{url} = "";
$anvil->Get->switches;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
'switches::abort' => $anvil->data->{switches}{abort},
'switches::job-uuid' => $anvil->data->{switches}{'job-uuid'},
'switches::overwrite' => $anvil->data->{switches}{overwrite},
'switches::save-to' => $anvil->data->{switches}{'save-to'},
'switches::script' => $anvil->data->{switches}{script},
'switches::url' => $anvil->data->{switches}{url},
}});
# If I don't have --abort or --url, see if there is a job waiting
if ((not $anvil->data->{switches}{abort}) && (not $anvil->data->{switches}{url}))
{
@ -195,7 +188,7 @@ sub download_file
my $failed = 0;
my $url = $anvil->data->{switches}{url};
my $file_name = ($url =~ /^.*\/(.*)$/)[0];
my $temp_file = $anvil->data->{path}{directories}{shared}{temp}."/".$file_name;
my $temp_file = $anvil->data->{path}{directories}{shared}{incoming}."/".$file_name;
my $save_to = $anvil->data->{switches}{'save-to'} ? $anvil->data->{switches}{'save-to'} : $anvil->data->{path}{directories}{shared}{files};
my $out_file = $save_to."/".$file_name;
$save_to =~ s/\/\///g;
@ -384,7 +377,7 @@ sub download_file
average_rate => $average_rate,
}});
my $line = "bytes_downloaded=$bytes_downloaded percent=$percent current_rate=$byte_rate average_rate=$average_rate seconds_running=$running_time seconds_left=$seconds_left url=$url out_file=$out_file";
my $line = "bytes_downloaded=".$bytes_downloaded." percent=".$percent." current_rate=".$byte_rate." average_rate=".$average_rate." seconds_running=".$running_time." seconds_left=".$seconds_left." url=".$url." out_file=".$out_file;
$next_report += $report_interval;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
line => $line,

Loading…
Cancel
Save