From 21a13abc2f629b1049ed84df2f0d35ee570ce829 Mon Sep 17 00:00:00 2001 From: Jerry Heiselman Date: Thu, 10 Jan 2019 11:13:48 -0600 Subject: [PATCH] Clarify editing cron job and specify that this represents a minimal effort solution --- Mediaserver-setup-[advanced].md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Mediaserver-setup-[advanced].md b/Mediaserver-setup-[advanced].md index f73a53f..b792fac 100644 --- a/Mediaserver-setup-[advanced].md +++ b/Mediaserver-setup-[advanced].md @@ -60,20 +60,20 @@ MediaServerDownload="https://yourserver.com/matterbridge" When using the local download configuration, matterbridge does not clean up any of the content it downloads to the Mediaserver path. ## Sidenote -If you run into issues with the amount of storage availble, then it is advised to do an automated cleanup which is to be done externally (i.e. via cron). An example cronjob and script are below: +If you run into issues with the amount of storage availble, then it is advised to do an automated cleanup which is to be done externally (i.e. via cron). An example of a clean up script and two examples of cron jobs are provided below. These represent the minimal amount of effort needed to handle this and don't take into account any ability to customize much. -Adding the cronjob: -Use crontab /etc/crontab to be able to add the following line. -crontab: -``` -@daily /path/to/matterbridge/cleanup.sh -``` - -The cronjob will now run cleanup.sh on a daily interval. The cleanup.sh with the following contents does a very basic clean up. cleanup.sh: ``` #!/bin/bash find /path/to/matterbridge -type d -mtime +30 | xargs rm -rf ``` +To run the script as the user running matterbridge, execute `crontab -e` and add the following line to the bottom of the file: +``` +@daily /path/to/matterbridge/cleanup.sh +``` + +If you want to run it as root, then it is easiest to add the script to /etc/cron.daily: +`cp /path/to/cleanup.sh /etc/cron.daily`. This will execute it daily automatically in most Redhat and Debian based Linux distros. + This will delete all downloaded content that is more than 30 days old. You should adjust the path and the max age to suit your own needs. \ No newline at end of file