Files
wekan/docs/Platforms/Webserver/Cron.md
T
Lauri Ojansivu c4cb87345b Reorganize documentation and repair links.
Move feature and webserver documentation into the reorganized hierarchy, update references to their new relative paths, and extend link validation across the complete documentation tree.\n\nThanks to xet7 !
2026-08-17 00:24:38 +03:00

1.5 KiB

(TODO: Try to integrate this inside WeKan Snap Candidate, or change code so that these would not be needed.)

WeKan has some memory leaks. To prevent WeKan becoming slow, this Cron script restarts WeKan Snap once every hour.

  1. Edit /root/hourly.sh
sudo su

apt -y install nano cron

nano /root/hourly.sh
  1. There add this text:
snap stop wekan.wekan

snap start wekan.wekan

# Wait 10 seconds
sleep 10

# Disable telemetry
/snap/wekan/current/usr/bin/mongosh wekan --eval 'disableTelemetry();' --port 27019

# Snap: Disable apparmor="DENIED" at syslog
# https://github.com/wekan/wekan/issues/4855
/snap/wekan/current/usr/bin/mongosh wekan \
--eval 'db.adminCommand({ setParameter: 1, diagnosticDataCollectionEnabled: false});' \
--port 27019

# Delete incomplete uploads so that they would not prevent starting WeKan
/snap/wekan/current/usr/bin/mongosh wekan \
--eval 'db.getCollection("cfs.attachments.filerecord").find( { "uploadedAt": { "$exists": true }, "copies.attachments" : null,"failures.copies.attachments.doneTrying" : {"$ne" : true}});' \
--port 27019
  1. Save and exit nano: Ctrl-o Enter Ctrl-x Enter

  2. Make hourly.sh script executeable, and edit cron:

chmod +x /root/hourly.sh

export EDITOR=nano

crontab -e

There at bottom, add this line, that will restart WeKan hourly, and log to textfile:

0 * * * * /root/hourly.sh >> /root/hourly-log.txt 2>&1
  1. Save and exit nano: Ctrl-o Enter Ctrl-x Enter

  2. You can also list content of cron:

crontab -l