Ram Disks

This revision is from 2024/06/15 23:18. You can Restore it.

#!/bin/bash # Set variables

RAMDISK_SIZE="1G"

MOUNT_POINT="/mnt/ramdisk"

WEB_SOURCE="/var/www/html"

WEB_DEST="$MOUNT_POINT/html"

# Create the mount point if it doesn't exist

mkdir -p $MOUNT_POINT

# Mount the RAM disk

mount -t tmpfs -o size=$RAMDISK_SIZE tmpfs $MOUNT_POINT

# Copy the website files

cp -r $WEB_SOURCE $WEB_DEST

# Start the web server (e.g., Apache or Nginx) # systemctl restart apache2 # or `systemctl restart nginx` for Nginx

  

📝 📜 ⏱️ ⬆️