Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

max_space option (issue 2) #4

Merged
merged 1 commit into from Jul 25, 2015
Merged

Conversation

simmstein
Copy link
Contributor

Add the max_space option

@jvaubourg
Copy link
Owner

Thank you for your contribution!

But, I think there is a problem with your solution:

df $base_path | tail -n 1 | awk '{print $5}' | sed 's/%//'

The base_path option corresponds to the root of the files for the webserver (e.g. /var/www/piratebox/). It not corresponds to any mount point and will not appear in the df list.

I thinks using df is not a good solution, because this requires une dedicated partition for the piratebox setup. And if the user has a dedicated partition, he does not need an option for limiting the max space.

@simmstein
Copy link
Contributor Author

If you give a random directory path to df, it will determine the associated mount point and return you the information you need.

$ df | grep secured
/dev/mapper/secured   164245908  58834748   97044824  38% /secured
$ df /secured/var
Sys. de fichiers    blocs de 1K  Utilisé Disponible Uti% Monté sur
/dev/mapper/secured   164245908 58834748   97044824  38% /secured

@jvaubourg
Copy link
Owner

Oh, okay, I didn't known that :).

But e.g. if the user has only one partition ("/") on its machine, the percentage corresponds to the space used by the whole system and not the space used by its piratebox. This feature is useful anyway but that is would not be better to use a PHP function to determine the size of the uploads/ folder?

@simmstein
Copy link
Contributor Author

It depends what you want to do:

  • set a maximum size to the upload directory
  • reduce sys admin problem with a disk 100% used
    I prefer the second solution because you don't want to overload your system.

Btw, we can have the 2 options :)

@jvaubourg
Copy link
Owner

You're right, I like this explanation. Even though I'm not sure creating new process (shell, df, tail, awk and sed) is really more efficient than computering a folder size with PHP.

jvaubourg added a commit that referenced this pull request Jul 25, 2015
max_space option (close #2)
@jvaubourg jvaubourg merged commit 7fd4b3d into jvaubourg:master Jul 25, 2015
@jvaubourg
Copy link
Owner

Your contribution was integrated to the corresponding YunoHost app: https://raw.githubusercontent.com/labriqueinternet/piratebox_ynh/master/screenshot_admin.png

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants