|If you'd like to run a mini "quotatally" for a given User if they upload or delete a file through the DA FileManager, you can use the script:|
to accomplish this.
For file deletion, we'd need to check for:
and for uploads, we'd need to check for:
NOTE: requires binaries compiled on after Feb 24th, 2016, or else the $username variable will be blank.
So create the script:
/usr/local/directadmin/scripts/custom/filemanager_pre.shand add the code:
chmod 755 /usr/local/directadmin/scripts/custom/filemanager_pre.sh
Keep in mind that we're using a "pre" script, meaning it's run before the actual action takes place.
This is because the File Manager cannot have a post.sh script due to the fact it's chrooted by the end of the action.
The implications of issuing the task.queue command before the action has taken place is that there is a very small chance that the disk usage could be updated before the action is finished, so the disk usage might actually be the old value, before the file was added/deleted. However, the odds of this race condition actually being true is very low. Uploaded files are already in /home/tmp before the action is done, so it only requires a rename (very fast), and deletions are also very fast, so they'll most likely beat the completion of the disk usage update. This condition also requires that the dataskq is called by cron at the exact moment of the upload/deletion, so that's lowers the odds even more.
© 2018 JBMC Software, Suite 173 3-11 Bellerose Drive, St Albert, AB T8N 1P7 Canada. Mon-Fri 9AM-5PM MST