OnWorks favicon

fai-class - Online in the Cloud

Run fai-class in OnWorks free hosting provider over Ubuntu Online, Fedora Online, Windows online emulator or MAC OS online emulator

This is the command fai-class that can be run in the OnWorks free hosting provider using one of our multiple free online workstations such as Ubuntu Online, Fedora Online, Windows online emulator or MAC OS online emulator



fai-class - define classes using files and scripts.




This command is only called internally by FAI and not directly by the user.

fai-class executes scripts in DIRECTORY to define classes. All classes are written to
CLASSFILE, each class on a separate line. Use absolute paths for both arguments. All
scripts or executables matching "^[0-9][0-9]*" (they start with two digits) are executed
in alphabetical order. They can define classes by writing the names of the classes to
stdout. Classes can be separated by spaces or written one on a line. All lines that start
with a "#" are comment lines and are ignored.

Shell scripts that end in ".sh" are sourced and can define classes by setting the variable
$newclasses. This is useful for scripts where you can't control stdout. Variables that are
defined in these scripts are available to other scripts in DIRECTORY, but they are not
exported to the shell that calls fai-class. Those scripts can define variables by writing
definitions to the file $LOGDIR/additional.var, which will be sourced in the following

All scripts can define additional classes by writing the classes to the file
$LOGDIR/additional-classes. These classes are defined after all scripts are executed. This
temporary file will be removed after use.

The order of the classes is important because it defines the priority of the classes from
low to high. First, the class DEFAULT is defined. Then all scripts are executed to define
classes. After that, the classes from the file $LOGDIR/additional-classes are added. Then,
all classes in the file with the hostname are added. Then classes defined by the variable
ADDCLASSES are used. This variable must be a comma separated list of classes. You can
define this variable on the kernel command line.

Finally, the class with the hostname and LAST are defined.

It's important that each line in a file containg a class name ends with a newline. If the
newline is missing on the last line of a file, this class can't be added.

The exit code of every script is written to the file status.log in LOGDIR.


-d Create debugging output.

-h Show help, version and summary of options.

-T Test if classes in CLASSFILE are defined multiple times. This should never happen.
The test is executed after the classes are defined.

-t tmpdir
The file additional-classes is read from the directory tmpdir. Default value is

-v Create verbose output.


In FAI, fai-class is used in the following way:

# fai-class /fai/class /tmp/fai/FAI_CLASSES

Then the list of all classes is assigned to the variable classes.

classes=`cat /tmp/fai/FAI_CLASSES`


This is the script 01alias:

#! /bin/sh

catnc() { # cat but no comment lines
grep -v "^#" $1
# echo architecture in upper case
dpkg --print-architecture | tr /a-z/ /A-Z/
uname -s | tr /a-z/ /A-Z/

# all hosts named ant?? use the classes in file anthill
case $HOSTNAME in
ant??) catnc anthill ;;

# a Beowulf cluster; all nodes except the master node
# use classes from file class/atoms
case $HOSTNAME in
atom00) echo BEOWULF_MASTER ;;
atom??) catnc atoms ;;

# if host belongs to class C subnet use class NET_6
case $IPADDR in
123.45.6.*) echo NET_6 ;;

Another EXAMPLE:

The script 24nis:

#! /bin/sh

# add NIS and the NIS domain name if YPDOMAIN is defined

if [ -n "$YPDOMAIN" ];then
echo "NIS $YPDOMAIN" | tr /.a-z-/ /_A-Z_/
echo NONIS

You can define classes on the kernel command line by appening this to the kernel:



All class names should be written in uppercase letters (execpt the class of the hostname).
Do not use a dash, use an underscore. Only executable scripts in DIRECTORY are used.
CLASSFILE is removed before writing to it. Scripts should not directly write to CLASSFILE.
LOGDIR should not be writable for everybody.

Use fai-class online using onworks.net services

Free Servers & Workstations

Download Windows & Linux apps

  • 1
    Phaser is a fast, free, and fun open
    source HTML5 game framework that offers
    WebGL and Canvas rendering across
    desktop and mobile web browsers. Games
    can be co...
    Download Phaser
  • 2
    VASSAL Engine
    VASSAL Engine
    VASSAL is a game engine for creating
    electronic versions of traditional board
    and card games. It provides support for
    game piece rendering and interaction,
    Download VASSAL Engine
  • 3
    OpenPDF - Fork of iText
    OpenPDF - Fork of iText
    OpenPDF is a Java library for creating
    and editing PDF files with a LGPL and
    MPL open source license. OpenPDF is the
    LGPL/MPL open source successor of iText,
    Download OpenPDF - Fork of iText
  • 4
    Toolbox for Java/JTOpen
    Toolbox for Java/JTOpen
    The IBM Toolbox for Java / JTOpen is a
    library of Java classes supporting the
    client/server and internet programming
    models to a system running OS/400,
    i5/OS, o...
    Download Toolbox for Java/JTOpen
  • 5
    D3.js (or D3 for Data-Driven Documents)
    is a JavaScript library that allows you
    to produce dynamic, interactive data
    visualizations in web browsers. With D3
    Download D3.js
  • 6
    A fast tunnel proxy that helps you
    bypass firewalls This is an application
    that can also be fetched from
    It ha...
    Download Shadowsocks
  • 7
    GLPI Themes
    GLPI Themes
    Download release at
    Color themes for GLPI 0.84 and 0.85 New
    Modifications for GLPI This is an
    application that c...
    Download GLPI Themes
  • More »

Linux commands