Hi everyone. I wanted to write here again because after some time I managed to resolve this situation without using the quota methods for each user.
What I did was simple, and I’m writing this for anyone who has this problem like me.
I created a script on the server where the various instances of ghost run that I called “monitor_space.sh”
Inside it I have inserted the various paths that I want to control and the space in MB that I want to give them as a limit. All closed in an array.
The script then checks whether the space has been exceeded for that folder. If it has been exceeded it makes all files in that folder read-only. In this way the upload to the site will never be successful and the internal error message will appear, but if the space has not been exceeded it will return the folder to its original permissions.
At this point, however, the script will not start automatically. To do this we should insert a scheduled action with crontab.
In the terminal, just type:
crontab -e
And at the end of the document we add this line:
*/2 * * * * sudo /var/www/monitor_space.sh
Now the script will check at 2 minute intervals whether the limit has been exceeded. If so it will make the folders all read-only, otherwise it will return them to write and read.
Now we need to make sure that the sudo command is executed without the crontab asking for the sudo password every time. So we enter this command:
sudo visudo
Then we go to the end of the line and insert this line:
yourusername ALL=(ALL) NOPASSWD: /var/www/monitor_space.sh
/var/www/ is the path where the .sh file was placed, but it can be placed anywhere.
Now the script will do everything automatically.
If we want to change the user size at some point, just open the monitor_space.sh file with Mousepad or another editor, and change the number next to the website folder. The script will recheck and set all folders to write and read again
If you want the script code you can contact me and I will provide it to you.