StoCS
Storage Control Service
versione italiana
Service to control freespace on disk, mantain free space in a configurable level.

Works with three thresholds:
  • WARN: do a configurable action (dialog, message, alarm, ecc)
  • FDEL: deletion limit
  • LOWL: dimension to reach after deletion
If define must be LOWL < WARN < FDEL

Threshold unit can be:
  • Total number of file and/or subdiectory
  • Total dimension of controlle folder (Byte,Kbyte,Mbyte,ecc)
  • % of fre space on unit
  • Max age of files and/or subdirs (in this case LOWL is not used because all that exeeds is deleted)

Can work with a config file or wih command line parameters. Command line parameters overwrites config file values. Does not implements loop. Therefore you must use cron os similar.

Download

Stocs v1.2
View files

Installation example

  • Copy stocs in /usr/local/bin
  • Copy stocs.conf in /usr/local/etc
  • Add to a cron.hourly (or a crontab):
    /bin/su user -c "/usr/local/bin/stocs \
        -c /usr/local/stc/stocs.conf \
        &> /var/log/stocs.log"
In this case stocs runs every hour, using the configuration in stocs.conf, the output is written to log file /var/log/stocs.log

Syntax

IMPORTANT NOTE: Stocs deletes files! Testing parameters with the DUMMY (or -t) flag is safety. More safety is run with a user whose rights are the minumum possible.
Usage : stocs [OPTION] CONFIGFILE
         
-V, --version                print version
-h, --help                   print this help
-v, --verbose			print what is going to do
-p, --path CONTROLPATH       path to control, must be a directory
-u, --unitused B|K|M|P|F|D|N|m|h|d|y unit used for limits
               B,K,M=dimension in Byte,Kbytes,MBytes;
               P=% used space on device;
               F,D,N=number of files,dirs,both;
               m,h,d,y=age in min,hours,days,years
-d, --device DEVICE          device to control, mandatory only if unitused is P
-w, --warnlevel WARNLEVEL    warning level
-f, --fdellevel FDELLEVEL    deletion level
-l, --lowllevel LOWLLEVEL    low level to reach when delete
-a, --warnaction WARNACTION  configurable action for warn level
-e, --fdelaction FDELACTION  configurable action for file deletion level
-t, --test                   don't touch filesistem, dummy test only

if there is no configuration file command ends with a -

Dependecies

Stocs is a shell script. Uses BASH builtins and du, df, date, awk, rm.



matteolucarelli.altervista.org