Blog
Home Previous Next

oC_blog

Published on April 5, 2026, 09:51

2nd posting about the creation of this blog.

Its now working within the main awsb.servebeer.com site although some graphics still need tweaking the code is tracking blogs from qownnotes.

Using ownCloud2 from user AB

To facilitate RPi4 syncing the blog & media files stored in ownCloud2 and using oC sync I tried combination of timers and services but in the end these were not required since oC worked.

The command is managed in django using watch_files.py which is driven by django_watchdog.service


pi@awsb:~ $ sudo cat /etc/systemd/system/django_watchdog.service

[Unit]

Description=Django Watchdog Service for file watching owncloud2/Blog and media

After=network.target

[Service]

Type=simple

User=pi

Group=pi

WorkingDirectory=/home/pi/web1/site1

Environment=PATH=/home/pi/web1/ve_django4/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin

ExecStart=/home/pi/web1/ve_django4/bin/python /home/pi/web1/site1/manage.py watch_files

Restart=on-failure

RestartSec=5

# Limit file descriptors if your watcher needs many

LimitNOFILE=65536

[Install]

WantedBy=multi-user.target

Tried but not required

Runs the owncloudcmd :


pi@awsb:~ $ cat oC_blog.sh

#!/bin/bash

# ~/oC_blog.sh

USERNAME="blog"

PASSWORD="7914920" # Or use .netrc for security

LOCAL_DIR="/home/pi/oC_blog"

SERVER_URL="https://awsbarker.ddns.net/owncloud/remote.php/webdav/"

owncloudcmd -u "$USERNAME" -p "$PASSWORD" "$LOCAL_DIR" "$SERVER_URL"

Runs the timer


pi@awsb:~ $ sudo cat /etc/systemd/system/oC_blog.timer

[Unit]

Description=oC_blog Sync Timer

Requires=oC_blog.service

[Timer]

OnBootSec=1min

OnUnitActiveSec=10s

Unit=oC_blog.service

[Install]

WantedBy=timers.target

runs the service


pi@awsb:~ $ sudo cat /etc/systemd/system/oC_blog.service

[Unit]

Description=oC_blog Sync

After=network-online.target

Wants=network-online.target

[Service]

Type=oneshot

User=pi

Environment="HOME=/home/pi"

ExecStart=/usr/bin/env bash /home/pi/oC_blog.sh

StandardOutput=journal

StandardError=journal

The watch_files command inside django watches for changes


pi@awsb:~ $ tree oC_blog -L 1

oC_blog

├── Blog

└── media

qownnotes-media-mLalCr