Skip to content

Commit 90b34c4

Browse files
committed
Update scripts for microarchiver -> pubarchiver
1 parent 8d1e7b5 commit 90b34c4

File tree

3 files changed

+36
-36
lines changed

3 files changed

+36
-36
lines changed

scripts/archive-in-portico

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# @brief Script meant to be run from cron
55
# @author Michael Hucka <[email protected]>
66
# @license Please see the file named LICENSE in the project directory
7-
# @website https://github.com/caltechlibrary/microarchiver
7+
# @website https://github.com/caltechlibrary/pubarchiver
88
#
99
# Principles:
1010
#
@@ -13,7 +13,7 @@
1313
# 2. The local output directory where files are saved is set by environment
1414
# variable PORTICO_OUTPUT.
1515
#
16-
# 3. A timestamp file is created in the output directory, and microarchiver
16+
# 3. A timestamp file is created in the output directory, and pubarchiver
1717
# is run with that date stamp as the "after date" argument.
1818
#
1919
# 4. Archives are created in subdirectories of the output directory named
@@ -81,34 +81,34 @@ echo "" >> $log
8181
if [[ -e $datestampfile ]]; then
8282
read afterdate < $datestampfile
8383
# Go back one day to include the run date in the argument given to
84-
# microarchiver's --after-date (or else we miss the day of the run itself).
84+
# pubarchiver's --after-date (or else we miss the day of the run itself).
8585
afterdate=$(date -d "$afterdate -1 days" +"%Y-%m-%d")
8686
else
8787
# We've never run, or someone reset the date stamp.
8888
# Use a fake date that basically signifies "since forever".
8989
afterdate="1900-01-01"
9090
fi
9191

92-
# Run microarchiver separately on past failures, leaving the results unpackaged
92+
# Run pubarchiver separately on past failures, leaving the results unpackaged
9393
# so that we can add to them the results of today's run.
9494
rerun_count=0
9595
if [[ -f $failurefile ]]; then
96-
echo "=== Running microarchiver on past failures ===" >> $log
96+
echo "=== Running pubarchiver on past failures ===" >> $log
9797
echo "" >> $log
9898
# Note the use of -Z to prevent zip'ing the final results.
99-
run_microarchiver -s portico -Z -C -a $failurefile -o $outputdir -r $report \
99+
run_pubarchiver -s portico -Z -C -a $failurefile -o $outputdir -r $report \
100100
-f csv,html -t Past_failures_retried -@ $debuglog
101101
echo "" >> $log
102102
fi
103103
mv $outputdir/report.html $outputdir/rerun-report.html
104104

105-
echo "=== Running microarchiver for new articles ===" >> $log
105+
echo "=== Running pubarchiver for new articles ===" >> $log
106106
echo "" >> $log
107107
this_report=$outputdir/latest-report.csv
108108
this_debuglog=$outputdir/latest-debug.log
109109
# This will add new articles to any existing ones from the past failures
110110
# code above, and this time will zip up the final result.
111-
run_microarchiver -s portico -C -d $afterdate -o $outputdir -r $this_report \
111+
run_pubarchiver -s portico -C -d $afterdate -o $outputdir -r $this_report \
112112
-f csv,html -t $today -@ $this_debuglog
113113

114114
# Combine separate report files, leave that, & delete the intermediate files.

scripts/helpers.sh

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# @brief Common shell functions used across multiple workflows
55
# @author Michael Hucka <[email protected]>
66
# @license Please see the file named LICENSE in the project directory
7-
# @website https://github.com/caltechlibrary/microarchiver
7+
# @website https://github.com/caltechlibrary/pubarchiver
88
#
99
# The code below assumes the following variables are set by the calling code:
1010
#
@@ -19,12 +19,12 @@
1919
# * SLACK_CHANNEL: Slack channel to send notifications of failure or success
2020
# * SLACK_CLI_TOKEN: used by slack-cli for the Slack API token
2121
#
22-
# The code below also assumes that programs "microarchiver" and "slack" (the
22+
# The code below also assumes that programs "pubarchiver" and "slack" (the
2323
# latter from https://github.com/rockymadden/slack-cli) are on the calling
2424
# user's command search $path.
2525
# =============================================================================
2626

27-
run_microarchiver() {
27+
run_pubarchiver() {
2828
# We have only two cases, Portico and PMC, so this grungy approach is good
2929
# enough for now. Future revisions should generalize this, though.
3030
destination=Portico
@@ -37,12 +37,12 @@ run_microarchiver() {
3737
done
3838
shopt -u nocasematch
3939

40-
# Next, make sure we can find microarchiver. If not, send mail & quit.
41-
if ! command -v microarchiver &> /dev/null; then
40+
# Next, make sure we can find pubarchiver. If not, send mail & quit.
41+
if ! command -v pubarchiver &> /dev/null; then
4242
body=$(cat <<EOF
43-
This is an error message generated by the process running microarchiver for
43+
This is an error message generated by the process running pubarchiver for
4444
uploading publications to $destination. The process is unable to find the
45-
program "microarchiver". This indicates either a configuration problem or
45+
program "pubarchiver". This indicates either a configuration problem or
4646
a change in the computer system where the process is executed. Manual
4747
intervention is required. Additional information may be found here:
4848
@@ -52,15 +52,15 @@ intervention is required. Additional information may be found here:
5252
This message was produced by $mainscript on `hostname`.
5353
EOF
5454
)
55-
echo "$body" | mail -s"microarchiver failure $today" $EMAIL_FAILURE
55+
echo "$body" | mail -s"pubarchiver failure $today" $EMAIL_FAILURE
5656
run_slack chat send --channel $SLACK_CHANNEL --color "#ff0000" \
5757
--title "Error: unable to upload micropublication.org to $destination" \
58-
--text "$mainscript on `hostname` cannot find program 'microarchiver'"
58+
--text "$mainscript on `hostname` cannot find program 'pubarchiver'"
5959
exit 1
6060
fi
6161

62-
# Run microarchiver with arguments and save output in $log
63-
count=$(microarchiver $@ 2>&1 | tee -a $log | grep "Total articles" | cut -d ' ' -f3)
62+
# Run pubarchiver with arguments and save output in $log
63+
count=$(pubarchiver $@ 2>&1 | tee -a $log | grep "Total articles" | cut -d ' ' -f3)
6464

6565
# If successful, return the num. of articles written, else send mail & quit
6666
status=$?
@@ -74,8 +74,8 @@ EOF
7474
*) cause="An unexpected error occurred during execution" ;;
7575
esac
7676
body=$(cat <<EOF
77-
This is an error message generated by the process running microarchiver for
78-
uploading publications to $destination. While doing its work, microarchiver has
77+
This is an error message generated by the process running pubarchiver for
78+
uploading publications to $destination. While doing its work, pubarchiver has
7979
encountered the following error:
8080
8181
$cause
@@ -86,12 +86,12 @@ bottom the log file to see what was the last action attempted.
8686
Today's upload to $destination has been stopped.
8787
EOF
8888
)
89-
echo "$body" | mail -s"microarchiver failure $today" -a $log $EMAIL_FAILURE
89+
echo "$body" | mail -s"pubarchiver failure $today" -a $log $EMAIL_FAILURE
9090
run_slack chat send --channel $SLACK_CHANNEL --color "#ff0000" \
9191
--title "Error: unable to complete $destination archiving for micropublication.org" \
92-
--text "microarchiver failed to create archive file for $destination. Cause: $cause."
92+
--text "pubarchiver failed to create archive file for $destination. Cause: $cause."
9393
run_slack file upload --channels $SLACK_CHANNEL --file $log \
94-
--comment "Here is the microarchiver run log:"
94+
--comment "Here is the pubarchiver run log:"
9595
exit $status
9696
fi
9797
}
@@ -118,7 +118,7 @@ run_curl() {
118118
# First, make sure we can find curl. If not, send mail & quit.
119119
if ! command -v curl &> /dev/null; then
120120
body=$(cat <<EOF
121-
This is an error message generated by the process running microarchiver for
121+
This is an error message generated by the process running pubarchiver for
122122
uploading publications to $destination. The process is unable to find the
123123
program "curl". This indicates either a configuration problem or a
124124
change in the computer system where the process is executed. Manual
@@ -145,7 +145,7 @@ EOF
145145
# The 2nd-to-last line will have a message from curl.
146146
problem=$(tail -n 2 $log | head -n 1)
147147
body=$(cat <<EOF
148-
This is an error message generated by the process running microarchiver for
148+
This is an error message generated by the process running pubarchiver for
149149
uploading publications to $destination. The "curl" command used to upload files to
150150
$destination failed with the following return status:
151151
@@ -162,7 +162,7 @@ EOF
162162
--title "Error: unable to complete PMC upload for micropublication.org" \
163163
--text "$mainscript unable to ftp to $destination. Cause: $problem."
164164
run_slack file upload --channels $SLACK_CHANNEL --file $log \
165-
--comment "Here is the microarchiver run log:"
165+
--comment "Here is the pubarchiver run log:"
166166
exit $status
167167
fi
168168
}

scripts/upload-to-pmc

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# @brief Script meant to be run from cron
55
# @author Michael Hucka <[email protected]>
66
# @license Please see the file named LICENSE in the project directory
7-
# @website https://github.com/caltechlibrary/microarchiver
7+
# @website https://github.com/caltechlibrary/pubarchiver
88
#
99
# Principles:
1010
#
@@ -13,7 +13,7 @@
1313
# 2. The local output directory where files are saved is set by environment
1414
# variable PMC_OUTPUT.
1515
#
16-
# 3. A timestamp file is created in the output directory, and microarchiver
16+
# 3. A timestamp file is created in the output directory, and pubarchiver
1717
# is run with that date stamp as the "after date" argument.
1818
#
1919
# 4. Archives are created in subdirectories of the output directory named
@@ -45,7 +45,7 @@ mainscript=${BASH_SOURCE[0]}
4545
today=$(date +%Y-%m-%d)
4646
datestampfile=$PMC_OUTPUT/last-run-date
4747

48-
# Today's run will be written in a subdirctory. Note the subdirectory name
48+
# Today's run will be written in a subdirectory. Note the subdirectory name
4949
# includes the current time, not just today's date, because otherwise we
5050
# would overwrite the previous data if we ran run multiple times per day.
5151
now=$(date +%Y-%m-%d-%H%M)
@@ -81,20 +81,20 @@ echo "" >> $log
8181
if [[ -e $datestampfile ]]; then
8282
read afterdate < $datestampfile
8383
# Go back one day to include the run date in the argument given to
84-
# microarchiver's --after-date (or else we miss the day of the run itself).
84+
# pubarchiver's --after-date (or else we miss the day of the run itself).
8585
afterdate=$(date -d "$afterdate -1 days" +"%Y-%m-%d")
8686
else
8787
# We've never run, or someone reset the date stamp.
8888
# Use a fake date that basically signifies "since forever".
8989
afterdate="1900-01-01"
9090
fi
9191

92-
echo "=== Running microarchiver for articles since $afterdate ===" >> $log
92+
echo "=== Running pubarchiver for articles since $afterdate ===" >> $log
9393
echo "" >> $log
9494
# This will get all articles since the last successful run. If there were
9595
# any failures, they will be tried again as a result of this, because we
9696
# don't upload and don't update the last-run date if there are any failures.
97-
run_microarchiver -s pmc -C -d $afterdate -o $outputdir -r $report -@ $debuglog
97+
run_pubarchiver -s pmc -C -d $afterdate -o $outputdir -r $report -@ $debuglog
9898

9999
# Did we have validation failures? Notify someone specifically about that.
100100
lines=$(egrep 'validation|missing|failed' $report | wc -l)
@@ -105,9 +105,9 @@ if [[ $lines -gt 0 ]]; then
105105

106106
run_slack chat send --channel $SLACK_CHANNEL --color "#ff0000" \
107107
--title "Error: did not upload micropublication.org to PMC" \
108-
--text "Microarchiver stopped PMC upload due to errors in $lines articles"
108+
--text "Pubarchiver stopped PMC upload due to errors in $lines articles"
109109
run_slack file upload --channels $SLACK_CHANNEL --file "$log" \
110-
--comment "Here is the microarchiver run log"
110+
--comment "Here is the pubarchiver run log"
111111
else
112112
# If we didn't have validation errors, ftp any new archives to PMC.
113113
# Note: curl has weird syntax for sending multiple files at once.
@@ -131,7 +131,7 @@ else
131131
# Post the report to Slack.
132132

133133
run_slack chat send --channel $SLACK_CHANNEL --color "#00ff00" \
134-
--title "microarchiver successfully completed PMC upload"
134+
--title "pubarchiver successfully completed PMC upload"
135135
run_slack file upload --channels $SLACK_CHANNEL --file $report \
136136
--comment "Here is the record of what was uploaded:"
137137
fi

0 commit comments

Comments
 (0)