From 5ccbfcd0aacaeef10763fee6691d66838ccf6259 Mon Sep 17 00:00:00 2001 From: nolim1t Date: Tue, 9 Jun 2020 21:10:05 +0700 Subject: [PATCH] Add swap --- contrib/partitioner/partitioner.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/contrib/partitioner/partitioner.py b/contrib/partitioner/partitioner.py index dfcebe4..cfbe322 100755 --- a/contrib/partitioner/partitioner.py +++ b/contrib/partitioner/partitioner.py @@ -132,6 +132,15 @@ def main(): os.system('/bin/cp -fr ' + homedirpath + '/bitcoin /mnt/data') os.system('/bin/cp -fr ' + homedirpath + '/lnd /mnt/data') os.system('/bin/cp -fr ' + homedirpath + '/nginx /mnt/data') + + if not os.path.exists('/mnt/data/swap'): + print('Add swap to partition') + os.system('sed -i "/CONF_SWAPFILE/s/^#//g; " /etc/dphys-swapfile') + os.system('sed -i "s/\/var\/swap/\/mnt\/data\/swap/g; " /etc/dphys-swapfile') + os.system('sed -i "s/CONF_SWAPSIZE=100/CONF_SWAPSIZE=2000/g; " /etc/dphys-swapfile') + print('Restarting dphys swapfile') + os.system('/etc/init.d/dphys-swapfile restart') + else: ''' No need to do anything