Skip to content
Snippets Groups Projects
Commit 4d4830c1 authored by egon w. stemle's avatar egon w. stemle :robot:
Browse files

Add cronjob as subshell (and ensure single run)

Instead of an external CronJob pod, or a supervisord cron daemon, we use
a subshell. Also we assume, the regular cronjob *also* needs to run when
the container starts. Insofar, we start the subshell, make sure it runs
a single time (and continues in the background) and then continue with
starting clarin-dspace.

Address #48
parent c177e570
No related branches found
No related tags found
No related merge requests found
#!/bin/sh #!/bin/bash
# replace environment variables in config files # replace environment variables in config files
perl -pi -e 's/\$\{DSPACE_USER\}/$ENV{DSPACE_USER}/; s/\$\{DSPACE_PASSWORD\}/$ENV{DSPACE_PASSWORD}/; s/\$\{MAIL_USER\}/$ENV{MAIL_USER}/; s/\$\{MAIL_PASSWORD\}/$ENV{MAIL_PASSWORD}/; s/\$\{DSPACE_DBNAME\}/$ENV{DSPACE_DBNAME}/; s/\$\{DSPACE_UTILSDBNAME\}/$ENV{DSPACE_UTILSDBNAME}/;' /opt/repository/sources/dspace/local.properties perl -pi -e 's/\$\{DSPACE_USER\}/$ENV{DSPACE_USER}/; s/\$\{DSPACE_PASSWORD\}/$ENV{DSPACE_PASSWORD}/; s/\$\{MAIL_USER\}/$ENV{MAIL_USER}/; s/\$\{MAIL_PASSWORD\}/$ENV{MAIL_PASSWORD}/; s/\$\{DSPACE_DBNAME\}/$ENV{DSPACE_DBNAME}/; s/\$\{DSPACE_UTILSDBNAME\}/$ENV{DSPACE_UTILSDBNAME}/;' /opt/repository/sources/dspace/local.properties
...@@ -16,9 +16,31 @@ perl -pi -e 's/\$\{HANDLE_USER\}/$ENV{HANDLE_USER}/; s/\$\{HANDLE_PASSWORD\}/$EN ...@@ -16,9 +16,31 @@ perl -pi -e 's/\$\{HANDLE_USER\}/$ENV{HANDLE_USER}/; s/\$\{HANDLE_PASSWORD\}/$EN
/opt/tomcat8/bin/startup.sh /opt/tomcat8/bin/startup.sh
cd /opt/repository/workspace/scripts cd /opt/repository/workspace/scripts
make init_statistics make init_statistics
make update_discovery
make update_oai # https://ubuntuforums.org/showthread.php?t=979694
/opt/lindat-dspace/installation/bin/dspace generate-sitemaps # Start process in the background and send its output to file descriptor 3
exec 3< <(while (true); do
make update_oai
make update_statistics
make update_sitemap
make lift_embargos
make update_openaire_cache
make update_discovery
echo "INIT DONE."
sleep 86400
done)
# Read the output of the process line by line until one line contains Ready
while read line; do
case "$line" in
"INIT DONE.")
break
;;
esac
done <&3
# Close the file descriptor
exec <&3 3<&-
/opt/tomcat8/bin/shutdown.sh -force /opt/tomcat8/bin/shutdown.sh -force
# start tomcat # start tomcat
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment