最后活跃于 1722577474

swapfile-proxomx.sh 原始文件
1#!/bin/bash
2
3# Define swapfile size and path
4SWAPFILE_PATH="/var/lib/vz/swapfile"
5SWAPFILE_SIZE="64G"
6
7# Create the swapfile with the specified size
8fallocate -l $SWAPFILE_SIZE $SWAPFILE_PATH
9
10# Set the correct permissions
11chmod 600 $SWAPFILE_PATH
12
13# Set up the swap space
14mkswap $SWAPFILE_PATH
15
16# Enable the swapfile
17swapon $SWAPFILE_PATH
18
19# Add the swapfile entry to /etc/fstab
20echo "$SWAPFILE_PATH none swap sw 0 0" >> /etc/fstab
21
22# Verify the swap is active
23swapon --show
24
25echo "64GB swapfile created and mounted successfully."
26