Skip to content

Commit edc4342

Browse files
scherztcThomas Scherz
and
Thomas Scherz
authored
Updates embargo scripts. (#1164)
* Updates embargo scripts. * Use ENVIRONMENT variable in embargo scripts. --------- Co-authored-by: Thomas Scherz <[email protected]>
1 parent f410c78 commit edc4342

File tree

2 files changed

+52
-4
lines changed

2 files changed

+52
-4
lines changed

script/embargo_notify.sh

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/bin/sh
2+
3+
# Notify editors that a work has been released
4+
# script/embargo_notify.sh [production|development]
5+
6+
ENVIRONMENT=$1
7+
8+
APP_DIRECTORY="$(dirname "$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" )"
9+
10+
11+
if [ $# -eq 0 ]; then
12+
echo -e "ERROR: no environment argument [production|development] provided"
13+
exit 1
14+
fi
15+
16+
if [ $ENVIRONMENT != "production" ] && [ $ENVIRONMENT != "development" ]; then
17+
echo -e "ERROR: environment argument must be either [production|development] most likely this will be development for local machines and production otherwise"
18+
exit 1
19+
fi
20+
21+
if [[ $ENVIRONMENT == "production" ]]; then
22+
export PATH=$PATH:/srv/apps/.gem/ruby/2.7.0/bin
23+
fi
24+
25+
banner "Notify Embargoe Editors"
26+
27+
cd $APP_DIRECTORY
28+
29+
RAILS_ENV=$ENVIRONMENT bundle exec rake embargo_notify

script/release_embargo.sh

+23-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,27 @@
1-
#!/bin/bash
1+
#!/bin/sh
22

33
# Change and expired embargoed objects to open access
44
# Runs as a cron job daily just after midnight
5+
# script/release_embargo.sh [production|development]
56

6-
cd "$(dirname "$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" )"
7-
export RELEASE_DATE=`date -v +1d "+%Y-\%m-\%d"`
8-
bundle exec rake embargo_release["$RELEASE_DATE"]
7+
ENVIRONMENT=$1
8+
9+
APP_DIRECTORY="$(dirname "$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" )"
10+
11+
if [ $# -eq 0 ]; then
12+
echo -e "ERROR: no environment argument [production|development] provided"
13+
exit 1
14+
fi
15+
16+
if [ $ENVIRONMENT != "production" ] && [ $ENVIRONMENT != "development" ]; then
17+
echo -e "ERROR: environment argument must be either [production|development] most likely this will be development for local machines and production otherwise"
18+
exit 1
19+
fi
20+
21+
if [[ $ENVIRONMENT == "production" ]]; then
22+
export PATH=$PATH:/srv/apps/.gem/ruby/2.7.0/bin
23+
fi
24+
25+
cd $APP_DIRECTORY
26+
export RELEASE_DATE=`date +\%Y-\%m-\%d -d "+1 day"`
27+
RAILS_ENV=$ENVIRONMENT bundle exec rake embargo_release["$RELEASE_DATE"]

0 commit comments

Comments
 (0)