diff --git a/scripts/blog.py b/scripts/blog.py index eb1b440..1e48008 100644 --- a/scripts/blog.py +++ b/scripts/blog.py @@ -63,6 +63,10 @@ JINJA_ENV = jinja2.Environment( autoescape=jinja2.select_autoescape() ) +WATCH = True +if os.getenv('WATCH_AND_REBUILD', '1') == '0': + WATCH = False + def update_statics(): global ARTICLE_TEMPLATE ARTICLE_TEMPLATE = JINJA_ENV.get_template(ARTICLE_TEMPLATE_NAME) @@ -521,6 +525,10 @@ def main(source_top, dest_top): docs = regen_all(source_top, dest_top) logging.info("Initial load completed in {:.2f}s".format(time.time() - t0)) + if not WATCH: + logging.info("Build completed in {:.2f}s".format(time.time() - t0)) + return 0 + ## Updating for event in notifier.event_gen(yield_nones=False): (ev, types, directory, file) = event diff --git a/scripts/upload.sh b/scripts/upload.sh index 482106c..1cc17cf 100644 --- a/scripts/upload.sh +++ b/scripts/upload.sh @@ -13,11 +13,15 @@ cd ../scripts rm -Rf ../_gen/notes WATCH_AND_REBUILD=0 python3 generate.py ~/.logs/brain ../_gen/notes +rm -Rf ../_gen/blog +WATCH_AND_REBUILD=0 python3 blog.py ~/cloud/nextcloud/blog/posts/ ../_gen/blog + # Upload notes cd ../_gen rsync -HPaz static/ --delete-after --exclude='*.html' root@codigoparallevar.com:/mnt/vols/misc/codigoparallevar/static/ rsync -HPaz notes/ --delete-after --exclude='xapian' --exclude='*.sqlite3' root@codigoparallevar.com:/mnt/vols/misc/codigoparallevar/notes/ rsync -HPaz notes/db.sqlite3 root@codigoparallevar.com:/mnt/vols/misc/codigoparallevar-api/ +rsync -HPaz blog/ --delete-after --exclude='xapian' --exclude='*.sqlite3' root@codigoparallevar.com:/mnt/vols/misc/codigoparallevar/blog/ # Restart API server ssh root@codigoparallevar.com docker restart notes-api-server