CAPTCHA
Image CAPTCHA
Enter the characters shown in the image.
This question is for testing whether or not you are human.
  • Create new account
  • Reset your password

User account menu

Home
The Hyperlogos
Read Everything

Main navigation

  • Home
  • My Resumé
  • blog
  • Howtos
  • Pages
  • Contact
  • Search

Script Snippet: Link additional storage

Breadcrumb

  • Home
  • User Blogs
  • User Blog
  • Script Snippet: Link additional storage
By drink | Sat July 15, 2023

I just rearranged some of my storage and wanted to automate this, and I was pleased enough that it worked exactly how I thought it should work that I thought I'd just share. This goes in /etc/profile.d on most Linux systems today.

#!/bin/bash
#
# storage.sh - profile.d script to make storage symlink
#
STORAGEDIR=/mnt/storage/users
if [ -d "${STORAGEDIR}/${USER}" ] && ( [ ! -e "${HOME}/storage" ] || [ -h "${HOME}/storage" ] )
then
        ln -sf "${STORAGEDIR}/${USER}" "${HOME}/storage"
fi

If you change the additional storage location, just update STORAGEDIR.

script
  • Log in or register to post comments

Footer menu

  • Contact
Powered by Drupal

Copyright © 2025 Martin Espinoza - All rights reserved