Skip to content

Commit

Permalink
Added cron replication script
Browse files Browse the repository at this point in the history
  • Loading branch information
Andy Townsend committed Jul 18, 2023
1 parent a7fdd31 commit bbe2b51
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions call_changesetmd_replication.sh
@@ -0,0 +1,26 @@
#!/bin/bash
#
# call_changesetmd_replication.sh
#
# Designed to be run from cron, as the user that owns the "changesets" database
# Status updates are written to the osm_changeset_state table in that database.
#
local_filesystem_user=localuseraccount
#
# First things first - is it already running?
#
wclines=`psql -d changesets -t -c "select update_in_progress from osm_changeset_state" | wc -l`;
if [ $wclines -eq 2 ]
then
cd /home/${local_filesystem_user}/src/ChangesetMD
source .venv/bin/activate
echo "ChangesetMD replication starting - current timestamp:"
psql -d changesets -t -c "select last_timestamp from osm_changeset_state"
python changesetmd.py -d changesets -r -g > /dev/null
echo "ChangesetMD replication complete - last timestamp:"
psql -d changesets -t -c "select last_timestamp from osm_changeset_state"
else
echo "ChangesetMD replication already running - last sequence:";
psql -d changesets -t -c "select last_sequence from osm_changeset_state"
fi
#

0 comments on commit bbe2b51

Please sign in to comment.