sysfsysf is nothing but a tool to maintain the system and
config files. Its
operations were designed to facilitate the reliable maintenance of a computer
network.
WARNING: sysf is an administration tools which can modify important
system files across an entire network. Configuring or using sysf
without a detailed understanding of how it works can seriously damage
vital files on many hosts at once. Although sysf has been
thoroughly tested
by its author there is no guarantee that it is entirely bug free. It is thus
recommended that every user tests new configurations on dummy files before
deploying them on a real system.
sysf.conf
The first step is to create a directory on a NFS mounted section of the
file-system which in what follow we assume to be
/usr/local/sys/config. This directory which we call the config directory will contain the config files and it must thus be visible on
every host with the same path.
After creating the config directory one must edit or create the file
sysf.conf in the config directory and create in it one entry for
each system file.
One should create an entry for every system file that has been modified
since the installation of the operating system. One must also create a
directory in the config directory for every config group
(etc, net and filesys in the example below).
Here is a short example of a sysf.conf file:
########### etc group ############################################ lilo.conf = etc /etc/lilo.conf lilo.conf h; sysf.cf = etc /etc/sysf.cf sysf.cf; syslog.conf = etc /etc/syslog.conf syslog.conf; ########### net group ############################################ network = net /etc/sysconfig/network network h; yp.conf = net /etc/yp.conf yp.conf; ########### filesys group ######################################## auto.home = filesys /etc/auto.home auto.home; auto.master = filesys /etc/auto.master auto.master; auto.misc = filesys /etc/auto.misc auto.misc; exports = filesys /etc/exports exports h; fstab = filesys /etc/fstab fstab h; smb.conf = filesys /etc/samba/smb.conf smb.conf h;
On systems using rpm, one can get the list off all the files which have been modified since they were installed by running the command
rpm -Va
The list returned is somewhat exhaustive. One should first ignore all the
files which do not have a c in the 10th column and then discard the
files which are created automatically (like fonts.dir files for example).
sysf.cf
The next step is to create the file /etc/sysf.cf on your working host.
A typical content should be
config_dir = /usr/local/sys/config; config_file = sysf.conf; remote_shell = ssh; rsh_com = /usr/bin/rsh; ssh_com = /usr/bin/ssh; mail_com = /bin/mail;where the path name for
config_dir must be the path of the config directory.
The entry for sysf.cf should then be added to the sysf.conf file.
sysf.cf = etc /etc/sysf.cf sysf.cf;
hosts.conf
One must then create the file hosts.conf in the config directory.
Each entry defines a host group
which share at least one config file. It must at least have an entry
for the
host group ALL as the list of all the computers maintained with
sysf. Here is an example:
DEAD = gates; SERVERS = kernighan ritchie; RedHat7.2 = trovald cox; ALL = kernighan ritchie pike trovald cox gates;
The next step is to create the default config file
for sysf.cf (sysf.cf.DEFAULT) by executing the command
# sysf -MD sysf.cf
We then create the /etc/sysf.cf file on every other host as
follow
# sysf -I -config_dir /usr/local/sys/config -h ALL sysf.cf -forgiving
where the forgiving flag allows sysf to install the file sysf.cf
even if various parameters are not set properly (something likely as there is
no /etc/sysf.cf yet).
We can now create the config files for every host. This can be done by
hand, or using sysf. One should start with a typical host and execute the
following command:
# sysf -new
This creates a config file for this host for each system file that
does not have a host group, a DEFAULT or a
SHARED config file yet (the .host config file
is overwritten if it exists).
One must then look at each config file and decide if they should be
considered as a default file or as a representative of
a given host group, and the file should be renamed with the appropriate
suffix.
One must also create the SHARED config files using the
-makeshared
command. When in doubt at this stage make the config file the default
file.
Some file, like fstab or lilo.conf, are likely to be specific to
each host. We can thus execute the following command to create them for every
host:
# sysf -archive fstab lilo -h ALL
Having done this, one now has to check each host one by one by executing the command
# sysf -check
which compare every config file with its system file and list those
that differ. One can use the command
# sysf -diff ENRTY_NAME
to check what the differences actually are.
Discrepancies can happen for the following reasons:
DEFAULT config file is not correct. One must then create
a config file for this host with the command -new (for this host
only) or with -makegroup (for an appropriate host group).host group config file is not correct. One must then
create
a config file for this host with the command -new (for this host
only), with -makegroup (for another more appropriate host group)
or with -makedef if the DEFAULT file does not exists yet.system file is incorrect and should be replaced by the
DEFAULT
or host group config file using the -install command.After repeating this on every hosts, sysf should be entirely configured.
One should still double check that it is by executing the command
# sysf -check ALL -h ALL -eh
and correct any remaining difference between the config and system
files.
Notice that to be able to update the system and config files from a
remote computer root must be able to rsh (or ssh) to that computer.
If this causes a major concern, one can deny rsh as root from any host
except from the server (which will be required if one uses tools like
rdump). One will thus be able to issue remote sysf command from no
host but the server.
sysf can help modify a system file, like fstab, as follow.
One starts by modifying the config file as required, keeping the
system file unchanged. Then the partition
that have been modified are unmounted by hand using the umount command
(this cannot always be done easily if the system file has been
modified directly).
The config file is then copied into the system file using
# sysf -install fstab
and finally the new partition are mounted with the command
mount -a.
system file on all computers at the same time.To modify a file like the root .login file, which is the same on all,
or at least on most, computers, one proceeds as follow. One will normally
modify
the config file, say root_login.DEFAULT, directly but sometimes it
is more convenient to modify the system file on one of the hosts
(cfr below).
Once the config file is ready, the command
# sysf -install root_login -host ALL
installs it on all computers.
Files can be updated globally on every member of a host group by
changing the word ALL, in the example above, by the appropriate
host group name.
system file directly.Sometimes a system file, say auto.master is modified directly.
This convenient when the system file needs to be tested.
To update the corresponding system file one must be careful.
If the config file is a host file, then one simply uses the command
# sysf -archive auto.master
on the host.
If the config file is a host group file, say RedHat7.2, then
one must use the -makegroup flag:
# sysf -archive auto.master -makegroup RedHat7.2
and update the system file on every host belonging to that
host group:
# sysf -install auto.master -host RedHat7.2
If on the other hand the system file must remain specific to this host,
one must create the corresponding host config file using the command
# sysf -new auto.master
If the config file is a DEFAULT file then one must use the
-makedef flag:
# sysf -makedef auto.master
and update the system file on all the hosts unless the system file
is to
remain specific to that host in which case one should use the -new flag
to create the host config file.
One can use sysf to execute a command remotely on many hosts at the same
time. For example, to install the package file
/usr/packages/new/NEW_APP-1.1-1.i386.rpm, which we assume to be
accessible from every hosts, we can execute the following csh
command:
# foreach host (`sysf -lah -h ALL`)
echo $host
rsh $host rpm -Uvh /usr/packages/new/NEW_APP-1.1-1.i386.rpm
end
Notice that we use the -lah flag instead of the -lhg so that
DEAD hosts are skipped automatically.
The script file oeh supplied with sysf does exactly the same.
It execute its argument list on every hosts. So to install the package
using oeh we would do
# oeh rpm -Uvh /usr/packages/new/NEW_APP-1.1-1.i386.rpm
oeh can also be used to execute a command on every member of a
host group. For example the command
# oeh -g SERVERS rpm -Uvh /usr/packages/new/NEW_APP-1.1-1.i386.rpm
will install the package on every host belonging to the host group
SERVERS.
Once sysf is fully configured to manage the important configuration
files it can be used to check the consistency of the network. One can either
execute the command
# sysf -c -h ALL -eh -m2 admin
by hand at regular interval. admin is the Email address to which
the result must be sent.
The best is probably to run a crontab job every week or every day using an entry like this:
05 7 * * 6 /usr/local/sys/bin/sysf -c -h ALL -eh -m2 admin >/dev/null 2>&1