EnglishFrenchSpanish

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

PROGRAM:

NAME


fai-class - define classes using files and scripts.

SYNOPSIS


fai-class [OPTION] DIRECTORY CLASSFILE

DESCRIPTION


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
task.

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.

OPTIONS


-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
/tmp/fai/.

-v Create verbose output.

EXAMPLES


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`

EXAMPLES FOR SCRIPTS


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 ;;
esac

# 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 ;;
esac

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

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_/
else
echo NONIS
fi

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

ADDCLASSES=CLASS1,CLASSX,CLASS3

NOTES


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
    XMLTV
    XMLTV
    XMLTV is a set of programs to process
    TV (tvguide) listings and help manage
    your TV viewing, storing listings in an
    XML-based format. There are utilities to
    do...
    Download XMLTV
  • 2
    strikr
    strikr
    Strikr Free Software project. Artifacts
    released under a 'intent based'
    dual license: AGPLv3 (community) and
    CC-BY-NC-ND 4.0 international
    (commercial)...
    Download strikr
  • 4
    GIFLIB
    GIFLIB
    giflib is a library for reading and
    writing gif images. It is API and ABI
    compatible with libungif which was in
    wide use while the LZW compression
    algorithm was...
    Download GIFLIB
  • 5
    Alt-F
    Alt-F
    Alt-F provides a free and open source
    alternative firmware for the DLINK
    DNS-320/320L/321/323/325/327L and
    DNR-322L. Alt-F has Samba and NFS;
    supports ext2/3/4...
    Download Alt-F
  • 6
    usm
    usm
    Usm is a unified slackware package
    manager that handles automatic
    dependency resolution. It unifies
    various package repositories including
    slackware, slacky, p...
    Download usm
  • More »

Linux commands

Ad