3037 links
  • Nono's Links
  • Home
  • Login
  • RSS Feed
  • ATOM Feed
  • Tag cloud
  • Picture wall
  • Daily
Links per page: 20 50 100
page 1 / 1
1 results tagged shell x
  • Snippet: Watch free space in shell script (not bash)
    J'ai dû faire un script en shell (et non bash) et j'ai eu quelques adaptation à faire.
    Du coup, je publie ici, au cas ou ca intéresse quelqu'un :

    ------
    #!/bin/sh

    threshold=90

    df -h | awk '{ print $6 " " $5 " " $4 }' |
    {
            while read output
            do
                    fs=$(echo $output | awk '{ print $1}')
                    capacity=$(echo $output | awk '{ print $2}')
                    free=$(echo $output | awk '{ print $3}')
                    #echo "$fs is used at $capacity ($free left)"
                    capa=`echo $capacity | sed 's/.$//'`
                    if [ $capa -gt $threshold ]; then
                            issue=true
                            result="$result $fs is used more than $threshold % ($free left)\n"
                    fi
            done

            if [ $issue ]
            then
                    # somthing wrong
            fi
    }
    ------
    March 10, 2022 at 1:47:44 PM GMT+1 - permalink -
    QRCode
    - http://shaarli.m0le.net/?PFWhzQ
    script shell snippet
Links per page: 20 50 100
page 1 / 1
Shaarli - The personal, minimalist, super-fast, database free, bookmarking service by the Shaarli community - Help/documentation