sysconfig -s src_dir [ -r root_dir ] [ -b backup_dir ] [ -o OSID ] [ -f ]
sysconfig -p [ -r root_dir ]
In addition to the prepared files, pre- and post exec scripts enable to run commands prior and after the application of the configuration files. Therefore the operating system configuration can be automated completely.
sysconfig should be used to configure the vanilla operating system as delivered by the vendor instead of including the configuration to the image as installed by Sun JumpStart, Hewlett-Packard Ignite, RedHat Kickstart, SuSE AutoYast etc. .
This has the advantage that the set of changed configurations is well known and it is more efficient to configure a future operating system version with the equal quality. Looking at the configuration repository it is easy to evaluate which files were adjusted to configure the operating system, without relying on configuration documentation. When including the configuration in the related image as mentioned above it is harder to see which files were changed and the possibility of not documenting the configuration changes is high. Furthermore it is more efficient to change the configuration in the sysconfig repository due to the fact that the repository has the same structure for all operating systems (HP-UX, Solaris, Linux, ...) and the user does not need to know the different image formats / install methods provided by the operating system vendor.
Optional: NO
Example: development.acme.com
Default: -
Optional: NO
Example: HP-11
Default: -
Optional: YES
Example:
# # README - Free text explanations/notes to the configuration # # [00] 02.05.2008 CWa Initial Version #
Default: -
Optional: YES
Example:
#!/bin/sh # # check - check if configuration is allowed # # [00] 08.02.2003 CWa Initial Version # # test "$DEBUG" = True && set -x Targethost=acme054 if [ "`hostname`" = "$Targethost" ]; then exit 0 else echo "apply this config on $Targethost only!" exit 1 fi
Default: allow configuration (exitcode=0)
Optional: YES
Example: ACME Development Department Configuration
Default: no description defined
Optional: YES
Example: BO
Default: -
Optional: YES
Example:
#!/bin/sh # # pre_exec - pre exec script # # [00] 04.04.2003 CWa Initial Version # # test "$DEBUG" = True && set -x touch $SYSCONFIG_ROOTDIR/exAppl/connect.lck /sbin/init.d/nfs.client stop
Default: -
Optional: YES
Example:
# # backup - list of files to be backuped # # [00] 08.02.2003 CWa Initial Version # etc/passwd
Default: no extra file backup
Do not use absolute pathnames, use only relative ones. This ensures that your configuration can be applied to any root_dir which is important if you plan to configure diskless clients on a server or simply for testing your configuration. Lines starting with a # or empty lines are considered as comments.
This file is copied to <root_dir>/.EDRC.config_byhand<.name>. If you change a file on the system and you think it might be handled by sysconfig you should add the filename to .EDRC.config_byhand<.name> to protect it from overwriting. This is also true for the .EDRC.config_byhand<.name> itself.
To dynamically merge the settings defined in an applied <root_dir>/.EDRC.config_byhand<.name> file and the settings of a config_byhand file in a sysconfig repository to be applied, set the CONFIG_BYHAND setting in the sysconfig.cfg configuration file to MERGE. In this case it has to be ensured that the .EDRC.config_byhand<.name> is not listed in the .EDRC.config_byhand<.name> or the config_byhand file, because this would protect the file from further change.
post_exec and pre_exec scripts should use is_config_byhand if they modify files to ensure it is not protected by a config_byhand setting.
Optional: YES
Example:
# # config_byhand - list of config by hand files # # [00] 26.10.2003 CWa Initial Version # etc/passwd etc/dfs/dfstab var/spool/cron/crontabs/root
Default: no files to be configured by hand
Optional: YES
Example:
# # remove - list of files to be removed # # [00] 08.02.2003 CWa Initial Version # etc/opt/app/lock.lk
Default: no extra file backup
Optional: NO
Optional: YES
Example:
#!/bin/sh # # post_exec - post exec script # # [00] 04.04.2003 CWa Initial Version # # test "$DEBUG" = True && set -x rm $SYSCONFIG_ROOTDIR/exAppl/connect.lck /sbin/init.d/nfs.client start
Default: -
There is no restriction of the naming of the configuration sources ( CONFIGURATION ).
However, it proofed to make sense to use a naming scheme as known from the Domain Name Service (DNS) due to the fact that it is well known and the hierarchical structure that is expandable and allows to start with a very simple configuration setup and enables to specify also very specialized configurations with clear naming.
Configuration naming convention following the DNS example:
|
See also the following examples.
This is an output example of the use of sysconfig on a vanilla HP-UX (OSID = HP-11) system. This configuration has no pre_exec script, but has a post_exec script. At this stage no config_byhand information is available. See also next example, where the configuration is re-applied.
If the hostname is not set, set it prior to applying the configuration using the hostname(1) command:
[ /root ] [ root@unknown ][-sh]: hostname acme001
Apply the configuration:
[ /root ] [ root@acme001 ][-sh]: ~edrc/bin/sysconfig \ -s /opt/edrc/scripts/ACME-sat/sysconfig/acme.ch sysconfig - configure a Unix/Linux system, by Chr. Walther DATE: Mon Jun 4 16:00:05 METDST 2007 HOSTNAME: acme001 CONFIGURATION: acme.ch/HP-11 ROOTDIR: / BACKUPFILE: 2007-06-04_16.00.05__sysconfig.cpio.gz FORCE: False configure system acme001 ... execute check script ... allow configuration (exitcode=0) done. write settings ... /.EDRC.sysconfig.base written done. execute pre exec script ... done. backup files in / ... evaluate files to backup ... etc/issue done. backup current files ... etc/issue 1 block done. done. remove files in / ... collect config_byhand settings ... <no files> done. evaluate files to remove ... <no files> done. backup current files ... <no files to backup> done. remove files ... <no files to remove> done. done. install files and directories in / ... collect config_byhand settings ... <no files> done. evaluate files to install ... .secure .secure/etc anw apl dat etc etc/auto_apl etc/auto_direct etc/auto_home : : etc/default etc/default/security etc/default/tz : : etc/group.description etc/hosts etc/hosts.equiv etc/inetd.conf etc/issue etc/lvmpvg etc/mail etc/mail/aliases etc/mail/mailcap etc/mail/sendmail.cf etc/mail/sendmail.cw etc/mail/service.switch etc/motd etc/netgroup etc/nsswitch.conf etc/ntp.conf etc/opt : : etc/rc.config.d etc/rc.config.d/auditing etc/rc.config.d/cmcluster etc/rc.config.d/nddconf etc/rc.config.d/netconf etc/rc.config.d/netdaemons etc/rc.config.d/nfsconf etc/rc.config.d/samba etc/rc.config.d/xntpd etc/resolv.conf etc/securetty etc/services : : opt/iexpress/sudo opt/iexpress/sudo/etc opt/iexpress/sudo/etc/sudoers opt/iexpress/sudo/etc/sudoers.main opt/iexpress/sudo/etc/sudoers.user opt/patrol opt/ssh opt/ssh/etc opt/ssh/etc/ssh_config opt/ssh/etc/sshd_config root root/.bashrc root/.cshrc : : var/spool var/spool/cron var/spool/cron/crontabs var/spool/cron/crontabs/root done. backup current files ... etc/auto_master etc/default/tz etc/group etc/hosts etc/inetd.conf etc/issue : : opt/ssh/etc/sshd_config var/adm/cron/at.allow var/adm/cron/cron.allow var/opt/perf/parm var/spool/cron/crontabs/root 373 blocks done. install new files ... /.secure /.secure/etc /anw /apl /dat /etc /etc/auto_apl /etc/auto_direct : : /var/opt/perf /var/opt/perf/parm /var/spool /var/spool/cron /var/spool/cron/crontabs /var/spool/cron/crontabs/root 8367 blocks done. done. execute post exec script ... apply2file - install a data stream as file, by Chr. Walther process file '//etc/issue' ... data written to file permissions of original file preserved done. post_exec-INFO: remove '//net' directory apply2file - install a data stream as file, by Chr. Walther process file '//etc/rc.config.d/netconf' ... data written to file permissions of original file preserved done. apply2file - install a data stream as file, by Chr. Walther process file '//.secure/etc/audnames' ... data written to file permissions set to (root:sys 600) done. done. write config_byhand ... /.EDRC.config_byhand.base written done. done.
This is the re-applying of the same configuration as applied in the example 1) above. See the now expanded list of files protected by config_byhand. In this example all files residing on the system are still identical with the files in the repository, therefore it was not needed to re-apply any file to the system.
[ /root ] [ root@acme001 ][-sh]: ~edrc/bin/sysconfig \ -s /opt/edrc/scripts/ACME-sat/sysconfig/acme.ch sysconfig - configure a Unix/Linux system, by Chr. Walther DATE: Mon Jun 4 16:13:27 METDST 2007 HOSTNAME: acme001 CONFIGURATION: acme.ch/HP-11 ROOTDIR: / BACKUPFILE: 2007-06-04_16.13.27__sysconfig.cpio.gz FORCE: False configure system acme001 ... execute check script ... allow configuration (exitcode=0) done. write settings ... /.EDRC.sysconfig.base written done. execute pre exec script ... done. backup files in / ... evaluate files to backup ... etc/issue done. backup current files ... etc/issue 1 block done. done. remove files in / ... collect config_byhand settings ... .EDRC.config_byhand.base .secure/etc/audnames etc/auto_dat etc/auto_master etc/ftpd/ftpusers etc/group etc/group.description : : etc/passwd.ownermap etc/rc.config.d/cmcluster etc/rc.config.d/netconf etc/su.allow opt/ACME/data/input/UsersToCheck root/.mycshrc root/.mykshrc root/.mylogin root/.myprofile tcb/files/auth/system/default var/spool/cron/crontabs/root done. evaluate files to remove ... <no files> done. backup current files ... <no files to backup> done. remove files ... <no files to remove> done. done. install files and directories in / ... collect config_byhand settings ... .EDRC.config_byhand.base .secure/etc/audnames etc/auto_dat etc/auto_master etc/ftpd/ftpusers etc/group etc/group.description : : etc/passwd.ownermap etc/rc.config.d/cmcluster etc/rc.config.d/netconf etc/su.allow opt/ACME/data/input/UsersToCheck root/.mycshrc root/.mykshrc root/.mylogin root/.myprofile tcb/files/auth/system/default var/spool/cron/crontabs/root done. evaluate files to install ... <no files> done. backup current files ... <no files to backup> done. install new files ... 0 blocks done. done. execute post exec script ... apply2file - install a data stream as file, by Chr. Walther process file '//etc/issue' ... data is identical with existing file, aborting done. post_exec-INFO: remove '//net' directory apply2file - install a data stream as file, by Chr. Walther process file '//etc/rc.config.d/netconf' ... data is identical with existing file, aborting done. apply2file - install a data stream as file, by Chr. Walther process file '//.secure/etc/audnames' ... data is identical with existing file, aborting done. done. write config_byhand ... /.EDRC.config_byhand.base protected, not written done. done.
Print the configuration applied to a system using sysconfig. This system has one configuration applied:
[ / ] [ root@acme001 ][-sh]: ~edrc/bin/sysconfig -p sysconfig - configure a Unix/Linux system, by Chr. Walther / - CONFIG: acme.ch NAME: OSID: HP-11 SOURCE: /opt/edrc/scripts/ACME-sat/sysconfig/acme.ch ROOTDIR: / BACKUPDIR: /opt/edrc/var/backup BACKUPFILE: 2007-06-04_16.13.27__sysconfig.cpio.gz DESCRIPTION: BASE PRODUCTION SERVER CONFIGURATION for Operating System EXECUTED: Mon Jun 4 16:13:27 METDST 2007
This is an efficient usage of sysconfig using two configurations.
The base configuration (acme.ch) defines the system behaviour for the whole ACME enterprise and the unnamed environment dependent configuration (production.acme.ch) defines the special configuration for the servers in the PRODUCTION environment.
[ /root ] [ root@acme002 ][-sh]: ~edrc/bin/sysconfig -p sysconfig - configure a Unix/Linux system, by Chr. Walther / - CONFIG: production.acme.ch NAME: OSID: HP-11 SOURCE: /opt/edrc/scripts/ACME-sat/sysconfig/production.acme.ch ROOTDIR: / BACKUPDIR: /opt/edrc/var/backup BACKUPFILE: 2005-07-12_20.09.27__sysconfig.cpio.gz DESCRIPTION: PRODUCTION SERVER CONFIGURATION for Operating System EXECUTED: Tue Jul 12 20:09:27 METDST 2005 / - base CONFIG: acme.ch NAME: base OSID: HP-11 SOURCE: /opt/edrc/scripts/ACME-sat/sysconfig/acme.ch ROOTDIR: / BACKUPDIR: /opt/edrc/var/backup BACKUPFILE: 2004-11-23_05.28.15__sysconfig.cpio.gz DESCRIPTION: BASE SERVER CONFIGURATION for Operating System EXECUTED: Tue Nov 23 05:28:15 EST 2004
This is a more advanced usage of sysconfig also including the configuration of cluster packages.
This output is from a system used in normal operations for PREPRODUCTION and in a disaster case as PRODUCTION. The system will be reconfigured (also using sysconfig ) during disaster recovery to give it the PRODUCTION' configuration.
This system has five configurations applied. In this case the base (acme.ch) configuration contains all basic configuration files of the ACME enterprise. The preproduction (preproduction.acme.ch) configuration is applied on top of the base configuration and contains all basic configuration of the PREPRODUCTION environment that will not be changed during a disaster recovery. The unnamed (normal.preproduction.acme.ch) configuration is applied on top of the preproduction configuration and contains only the files that are needed to configure the system as a PREPRODUCTION system in NORMAL OPERATIONS. This part of the configuration will be replaced with the unnamed (disaster.preproduction.acme.ch) configuration to re-configure the system in case of disaster and give it the PRODUCTION' identity.
The configurations dwh_db1 and dwh_db2 are the configurations of cluster packages, that are reconfiguired during disaster recovery, too.
To ensure that the cluster package configuration is only displayed on the node where the cluster package is running, prior to the execution of sysconfig a symbolic link to the settings file has to be created. This will place the settings file to a moving file system:
[ / ] [ root@acme003 ][-sh]: ln -s /data_dwh1/.EDRC.sysconfig.dwh_db1 \ .EDRC.sysconfig.dwh_db1
The symbolic link has to be created on each node where the cluster package is able to start.
In this case the filesystems /data_dwh1/, /ora0[1-3]_dwh1/ are moved with the cluster package, that's also the reason why the configurations of the cluster packages are needed to be applied to the root directory ( / ).
[ /root ] [ root@acme003 ][-sh]: ~edrc/bin/sysconfig -p sysconfig - configure a Unix/Linux system, by Chr. Walther / - CONFIG: normal.preproduction.acme.ch NAME: OSID: HP-11 SOURCE: /opt/edrc/scripts/ACME-sat/sysconfig/normal.preproduction.acme.ch ROOTDIR: / BACKUPDIR: /opt/edrc/var/backup BACKUPFILE: 2005-07-12_20.30.04__sysconfig.cpio.gz DESCRIPTION: NORMAL OPERATION PREPRODUCTION SERVER CONFIGURATION for Operating System EXECUTED: Tue Jul 12 20:30:04 METDST 2005 / - preproduction CONFIG: preproduction.acme.ch NAME: preproduction OSID: HP-11 SOURCE: /opt/edrc/scripts/ACME-sat/sysconfig/preproduction.acme.ch ROOTDIR: / BACKUPDIR: /opt/edrc/var/backup BACKUPFILE: 2004-11-25_14.54.06__sysconfig.cpio.gz DESCRIPTION: BASE PREPRODUCTION SERVER CONFIGURATION for Operating System EXECUTED: Thu Nov 25 14:54:06 MET 2004 / - base CONFIG: acme.ch NAME: base OSID: HP-11 SOURCE: /opt/edrc/scripts/ACME-sat/sysconfig/acme.ch ROOTDIR: / BACKUPDIR: /opt/edrc/var/backup BACKUPFILE: 2004-11-24_15.00.01__sysconfig.cpio.gz DESCRIPTION: BASE SERVER CONFIGURATION for Operating System EXECUTED: Wed Nov 24 15:00:01 MET 2004 / - dwh_db1 CONFIG: dwh_db1.normal.preproduction.acme.ch NAME: dwh_db1 OSID: HP-11 SOURCE: /opt/edrc/scripts/ACME-sat/sysconfig/dwh_db1.normal.preproduction.acme.ch ROOTDIR: / BACKUPDIR: /opt/edrc/var/backup BACKUPFILE: 2007-08-20_12.38.37__sysconfig.cpio.gz DESCRIPTION: NORMAL OPERATION PREPRODUCTION CONFIGURATION for Cluster Package dwh_db1_pre EXECUTED: Mon Aug 20 12:38:38 METDST 2007 / - dwh_db2 CONFIG: dwh_db2.normal.preproduction.acme.ch NAME: dwh_db2 OSID: HP-11 SOURCE: /opt/edrc/scripts/ACME-sat/sysconfig/dwh_db2.normal.preproduction.acme.ch ROOTDIR: / BACKUPDIR: /opt/edrc/var/backup BACKUPFILE: 2007-08-20_12.38.42__sysconfig.cpio.gz DESCRIPTION: NORMAL OPERATION PREPRODUCTION CONFIGURATION for Cluster Package dwh_db2_pre EXECUTED: Mon Aug 20 12:38:43 METDST 2007
This is free software; see edrc/doc/COPYING for copying conditions. There is ABSOLUTELY NO WARRANTY; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.