J
J
julowelu2017-02-07 12:38:53
linux
julowelu, 2017-02-07 12:38:53

How to limit the capacity of a folder on the server?

The logic of the program is as follows.
When you run a php script, it in turn launches the .sh script for execution.
Files are downloaded to a certain folder.
It is not known in advance how many files.
You need to somehow set a limit on downloading files to a folder, i.e. when the folder is full, then .sh should be chopped off by itself.
Let's say the folder capacity is 5 MB and no more.
How to do this using Linux?
Many scripts and folders can work at the same time, so controlling everything through PHP is resource-intensive + there is no pointer to stop the script.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
Dmitry MiksIr, 2017-02-07
@miksir

After each jump in the sh script, check the size of the folder (du -s) and if it exceeds, exit. If the files are small, then the error due to multithreading will not be very large.

S
Sanes, 2017-02-07
@Sanes

If you can divide into different owners, then look towards disk quotas.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question