|
@ -2,22 +2,27 @@ |
|
|
|
|
|
|
|
|
function ee_lib_create_swap() |
|
|
function ee_lib_create_swap() |
|
|
{ |
|
|
{ |
|
|
# Use dd command to create SWAP |
|
|
if [ $EE_TOTAL_RAM -le 512 ]; then |
|
|
# Swap Parameters: |
|
|
if [ $EE_TOTAL_SWAP -le $EE_SWAP ];then |
|
|
# Location: /swapfile |
|
|
|
|
|
# Block Size: 1024 |
|
|
|
|
|
dd if=/dev/zero of=/swapfile bs=1024 count=1024k &>> $EE_COMMAND_LOG \ |
|
|
|
|
|
|| ee_lib_error "Unable to generate /swapfile, exit status = " $? |
|
|
|
|
|
|
|
|
|
|
|
# Create it as a Swap |
|
|
# Use dd command to create SWAP |
|
|
mkswap /swapfile &>> $EE_COMMAND_LOG \ |
|
|
# Swap Parameters: |
|
|
|| ee_lib_error "Unable to create swapfile, exit status = " $? |
|
|
# Location: /swapfile |
|
|
|
|
|
# Block Size: 1024 |
|
|
|
|
|
dd if=/dev/zero of=/swapfile bs=1024 count=1024k &>> $EE_COMMAND_LOG \ |
|
|
|
|
|
|| ee_lib_error "Unable to generate /swapfile, exit status = " $? |
|
|
|
|
|
|
|
|
# On the Swap |
|
|
# Create it as a Swap |
|
|
swapon /swapfile &>> $EE_COMMAND_LOG \ |
|
|
mkswap /swapfile &>> $EE_COMMAND_LOG \ |
|
|
|| ee_lib_error "Unable to on Swap, exit status = " $? |
|
|
|| ee_lib_error "Unable to create swapfile, exit status = " $? |
|
|
|
|
|
|
|
|
# Add entry into /etc/fstab |
|
|
# On the Swap |
|
|
echo "/swapfile none swap sw 0 0" >> /etc/fstab \ |
|
|
swapon /swapfile &>> $EE_COMMAND_LOG \ |
|
|
|| ee_lib_error "Unable to add entry into /etc/fstab, exit status = " $? |
|
|
|| ee_lib_error "Unable to on Swap, exit status = " $? |
|
|
|
|
|
|
|
|
|
|
|
# Add entry into /etc/fstab |
|
|
|
|
|
echo "/swapfile none swap sw 0 0" >> /etc/fstab \ |
|
|
|
|
|
|| ee_lib_error "Unable to add entry into /etc/fstab, exit status = " $? |
|
|
|
|
|
fi |
|
|
|
|
|
fi |
|
|
} |
|
|
} |
|
|