Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4273640
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T07:44:24+00:00 2026-05-21T07:44:24+00:00

I bought a NAS box which has a cut down version of debian on

  • 0

I bought a NAS box which has a cut down version of debian on it.

It ran out of space the other day and I did not realise. I am basically wanting to write a bash script that will alert me whenever the disk gets over 90% full.

Is anyone aware of a script that will do this or give me some advice on writing one?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T07:44:25+00:00Added an answer on May 21, 2026 at 7:44 am
    #!/bin/bash
    source /etc/profile
    
    # Device to check
    devname="/dev/sdb1"
    
    let p=`df -k $devname | grep -v ^File | awk '{printf ("%i",$3*100 / $2); }'`
    if [ $p -ge 90 ]
    then
      df -h $devname | mail -s "Low on space" my@email.com
    fi
    

    Crontab this to run however often you want an alert

    EDIT: For multiple disks

    #!/bin/bash
    source /etc/profile
    
    # Devices to check
    devnames="/dev/sdb1 /dev/sda1"
    
    for devname in $devnames
    do
      let p=`df -k $devname | grep -v ^File | awk '{printf ("%i",$3*100 / $2); }'`
      if [ $p -ge 90 ]
      then
        df -h $devname | mail -s "$devname is low on space" my@email.com
      fi
    done
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I bought a personal dev box which I will use for deploying stuff I
I recently bought and read a box set of books on security ( Building
I bought a book on Amazon which was meant to prepare me for 70-536
I bought the Windows Developer hosting package from fasthosts.co.uk, which I believe is a
I bought a third-party Java library which includes a JAR file and two DLL
I bought Delphi 1 when it came out - and was hooked. When BCB
There is query which is asking for favourite products which is bought by each
I bought a very weak netbook that comes preinstalled with android 2.0 which I
I bought a SSL certificate for the domain https://www.mypage.com . I have other domains
Just bought a 2.4GHz Intel Core 2 Duo iMac with 2GB of memory and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.