xrdp_apphost: Implemented cleanup of old files

All files older than 30 days as well as empty folders
will be automatically deleted.
This commit is contained in:
Thomas Basler 2022-01-09 16:37:41 +01:00
parent 9eef0c7739
commit 2d645a13f4
5 changed files with 51 additions and 1 deletions

View File

@ -21,6 +21,8 @@ xrdp_ls_btn_ok_y_pos: 370
xrdp_ls_btn_cancel_x_pos: 237 xrdp_ls_btn_cancel_x_pos: 237
xrdp_ls_btn_cancel_y_pos: 370 xrdp_ls_btn_cancel_y_pos: 370
info_folder_name: "___Files\ older\ than\ 30\ days\ will\ be\ automatically\ deleted"
lightburn_user: lightburn lightburn_user: lightburn
lightburn_group: lightburn lightburn_group: lightburn
lightburn_pass: fckgw01lightburn lightburn_pass: fckgw01lightburn

View File

@ -34,3 +34,11 @@
- name: Create Estlcam data directory - name: Create Estlcam data directory
file: path=/home/{{ estlcam_user }}/data state=directory mode=0755 owner={{ estlcam_user }} group={{ estlcam_group }} file: path=/home/{{ estlcam_user }}/data state=directory mode=0755 owner={{ estlcam_user }} group={{ estlcam_group }}
- name: Create info directory
file:
path: "/home/{{ estlcam_user }}/data/{{ info_folder_name }}"
state: directory
mode: 0444
owner: root
group: root

View File

@ -18,6 +18,14 @@
- name: Create LightBurn data directory - name: Create LightBurn data directory
file: path=/home/{{ lightburn_user }}/data state=directory mode=0755 owner={{ lightburn_user }} group={{ lightburn_group }} file: path=/home/{{ lightburn_user }}/data state=directory mode=0755 owner={{ lightburn_user }} group={{ lightburn_group }}
- name: Create info directory
file:
path: "/home/{{ lightburn_user }}/data/{{ info_folder_name }}"
state: directory
mode: 0444
owner: root
group: root
- name: Download LightBurn binary - name: Download LightBurn binary
get_url: url={{ lightburn_url }} dest={{ lightburn_target }} checksum={{ lightburn_checksum }} mode=0755 get_url: url={{ lightburn_url }} dest={{ lightburn_target }} checksum={{ lightburn_checksum }} mode=0755
notify: Install LightBurn notify: Install LightBurn

View File

@ -35,3 +35,27 @@
- name: Create tsadmin_user .xsession - name: Create tsadmin_user .xsession
template: src=tsadmin_xsession.j2 dest=/home/{{ tsadmin_user }}/.xsession template: src=tsadmin_xsession.j2 dest=/home/{{ tsadmin_user }}/.xsession
- name: Create file cleanup cron
cron:
name: "Delete files older than 30 days"
minute: "0"
hour: "5"
job: "find /home/{{ item }}/data -type f -mtime +30 ! -name \"{{ info_folder_name }}\" -delete"
user: "{{ item }}"
with_items:
- "{{ estlcam_user }}"
- "{{ lightburn_user }}"
- "{{ slicer_user }}"
- name: Create directory cleanup cron
cron:
name: "Delete empty directories"
minute: "1"
hour: "5"
job: "find /home/{{ item }}/data -type d -empty ! -name \"{{ info_folder_name }}\" -delete"
user: "{{ item }}"
with_items:
- "{{ estlcam_user }}"
- "{{ lightburn_user }}"
- "{{ slicer_user }}"

View File

@ -17,5 +17,13 @@
- name: Create Slic3r data directory - name: Create Slic3r data directory
file: path=/home/{{ slicer_user }}/data state=directory mode=0755 owner={{ slicer_user }} group={{ slicer_group }} file: path=/home/{{ slicer_user }}/data state=directory mode=0755 owner={{ slicer_user }} group={{ slicer_group }}
- name: Create info directory
file:
path: "/home/{{ slicer_user }}/data/{{ info_folder_name }}"
state: directory
mode: 0444
owner: root
group: root
- name: Download Slic3r binary - name: Download Slic3r binary
get_url: url={{ slicer_url }} dest={{ slicer_target }} checksum={{ slicer_checksum }} mode=0755 get_url: url={{ slicer_url }} dest={{ slicer_target }} checksum={{ slicer_checksum }} mode=0755