Makeswap script
This commit is contained in:
parent
d4c557b290
commit
a1ce98a14d
|
@ -4,7 +4,7 @@ class sunetdrive::scriptreceiver()
|
||||||
sunet::system_user {'script': username => 'script', group => 'script', managehome => true, shell => '/bin/bash' }
|
sunet::system_user {'script': username => 'script', group => 'script', managehome => true, shell => '/bin/bash' }
|
||||||
|
|
||||||
# These tasks correspond to a ${task}.erb.sh template
|
# These tasks correspond to a ${task}.erb.sh template
|
||||||
$tasks = ['list_users', 'list_files_for_user', 'create_bucket', 'backup_db', 'purge_backups', 'maintenancemode', 'restart_sunet_service', 'start_sentinel', 'stop_sentinel']
|
$tasks = ['list_users', 'list_files_for_user', 'create_bucket', 'backup_db', 'purge_backups', 'maintenancemode', 'restart_sunet_service', 'start_sentinel', 'stop_sentinel', 'makeswap']
|
||||||
|
|
||||||
$environment = sunetdrive::get_environment()
|
$environment = sunetdrive::get_environment()
|
||||||
$config = hiera_hash($environment)
|
$config = hiera_hash($environment)
|
||||||
|
|
12
templates/scriptreceiver/makeswap.erb.sh
Normal file
12
templates/scriptreceiver/makeswap.erb.sh
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
if ! [[ -f /swapfile ]]; then
|
||||||
|
gb=$(free --gibi| grep Mem: | awk '{print $2}')
|
||||||
|
fallocate -l "${gb}G" /swapfile
|
||||||
|
chmod 600 /swapfile
|
||||||
|
mkswap /swapfile
|
||||||
|
swapon /swapfile
|
||||||
|
if ! grep -E '^(#)?/swapfile' /etc/fstab; then
|
||||||
|
echo '/swapfile none swap sw 0 0' >> /etc/fstab
|
||||||
|
fi
|
||||||
|
fi
|
Loading…
Reference in a new issue