Closed skilver-io closed 2 years ago
Thanks for the feedback @skilver-io
I haven't tested this since your report however the purpose of that snippet is that ss-install-ubuntu-swapfile
will not try to install any swapfile if an existing swapfile is detected in /etc/fstab
So the ss-install
routine (etc) should still be able to continue fine, at least in theory.
This snippet was added a few days ago because I noticed some cloud providers like Vultr seem to now be adding swapfiles automatically in some cases under /swapfile
filepath, which means that SlickStack literally cannot install a new swap using our own scripts in those situations.
Sorry I think I understand what you're saying now, the exit 1
stops the entire ss-install
from running?
I've never played with the return
function (instead of exit
) because from my understanding, that would mean scripts such as ss-install-ubuntu-swapfile
can no longer be called as independent scripts.
And wrapping the entire script in a bash function would still "run" the rest of the script which is janky IMO.
I'm not sure what the cleanest solution would be here.
Commented out for now:
Ref: https://github.com/littlebizzy/slickstack/commit/499bc8a659135f5c30ce298d5435b4db2a205ad5
Hi @jessuppi,
Sorry I think I understand what you're saying now, the exit 1 stops the entire ss-install from running?
Yes, the entire SS installation process will exit.
Shouldn't it be ok to reverse the if statement to check if there is no swapfile?
The rest of the code would go inside of the if statement and only run if there is no swapfile found. In this case no exit
is needed.
I also want to suggest to move the $SS_SWAPFILE" != "false"
statement to the very beginning, since there shouldn't be any reason to run the script at all if the option is turned off.
Best, Den
Had to comment out this one too for now:
Ref: https://github.com/littlebizzy/slickstack/commit/782d602529dc2dd98edf446b8b1a1528c602d876
ss-perms-ubuntu-swapfile
I also want to suggest to move the $SS_SWAPFILE" != "false" statement to the very beginning, since there shouldn't be any reason to run the script at all if the option is turned off.
Preparing to do this: https://github.com/littlebizzy/slickstack/commit/2fd93dcc3f06816dacaec821f7e88d5001dcee4b
Shouldn't it be ok to reverse the if statement to check if there is no swapfile? The rest of the code would go inside of the if statement and only run if there is no swapfile found. In this case no exit is needed.
You are correct, however I have tried to avoid putting entire bash scripts inside if statements because it just feels janky and makes it harder to read and format the code.
It is sort of the same concept on those Stack Exchange links, putting the entire thing in a bash function.
After more consideration and after some providers like Vultr began force-installing 2GB swapfiles, we decided that swapfiles will now be required for SlickStack, and only the 2GB size will be installed going forward, regardless of how much space that your server might have on disk... anyway, larger servers tend to have more RAM anyways.
Therefore SS_SWAPFILE
option is now removed from ss-config
and more importantly, the script will no longer exit in any case and it will simply check if swap exists yet or not before installeding:
Ref: https://github.com/littlebizzy/slickstack/blob/master/bash/ss-install-ubuntu-swapfile.txt
if [[ -z $(grep "swapfile" /etc/fstab 2> /dev/null) ]] && [[ $DISK_REMAINING_MB -gt 5000 ]]; then
...
While some general code cleanup would be nice, this Issue should now be resolved.
Hi @jessuppi ,
Unfortunately, the SS can't be updated or installed again once the swapfile was created. The install process will exit:
I tried some workarounds without success:
The existing swapfile is not taken into account in the
slickstack/bash/ss-install-ubuntu-swapfile.txt
Is there any workaround for now?
Best, Den