Administrative Tasks

About

In this chapter we will cover the basic administrative tasks using the command tools.

start / stop services

To control which programs that shall run on the system when it is started you can use following commands.

# chkconfig service

chkconfig can be used to control which programs that should be started during the boot sequence. It can also show you the current configuration.

A service can start and stop programs during runtime. This is for example useful if you would like to restart OP5 Monitor.

# chkconfig --list

List which programs that shall be started at boot time. This command first list the program name and then seven columns that represents different run-levels. All you have to care about is runlevel 3 which is the default runlevel for OP5 System.

# chkconfig smsd on
# chkconfig smsd off

Tells the system to start or stop the smsd program during boot time.

# service monitor stop
# service monitor start

Turns on and off OP5 Monitor during runtime.

Shutdown or restart

To shutdown the system in a proper way you should log onto the system as root user and issue the following command.

# shutdown -h now

This means that the system will shutdown all running programs and then halt. After this it is safe to shut down the power to the system.

To restart the system issue the command reboot or press Control-Alt-Delete on the console.

Backing up the System

It is important to backup your OP5 System to be able to restore configuration and important data in case of a system failure.

There are several ways to backup the system. Since op5 System is based on CentOS 6 most large providers of backup solutions has clients that can be installed on the OP5 System.

For those cases where backup possibilities for linux systems does not exist we have created a backup utility called op5backup that can create backups of system configuration data and op5 product configurations and data.

OP5backup consists of a backup script and a restore script. The backup script op5-backup can be scheduled to run using cron and it can place the backups in a local or remote mounted directory or transfer the file to another server over FTP.

OP5 backup will not backup logs of op5-logserver, so you better have remote archive setuped for this, or backup them manually.

To get a list of all functions available for op5-backup use the op5-backup --help command

Configuration

The main configuration file for op5backup is placed in the following file:

/etc/op5-backup/main.conf

Following variables needs to be set transfer=, set this to ftp,sftp or local If you use local as transfer location the configure this variable

storagepath=, set this to where the backup should be placed

If you use ftp or sftp as transfer mode then configure following variables

backupserver=, set this to a FQDN or IP address to you ftp or sftp server

backuppath=, set this to the path where you want your backups. Leave blank if no path is needed.

backupuser=, username for the ftp/sftp account

backuppass=, password for the ftp/sftp account If you have added software or data to your OP5 System that you want to be included in the backup you should add this to the /etc/op5-backup/modules/custom file.

The backup modules is written in bash uses a set of variables and functions. The table below describes the variables used in a backup module script

Variable Description
DESCRIPTION A short description of the module.
FILES_TO_BACKUP The files and folders to backup with this module. It can contain both single files, filenames with wildcards like * and whole folders.
WORK_DIR The folder where file will temporary be stored during the backup. Make sure there is enough free space here.

The following table describes the function used in a OP5 backup module:

Function Description
CHECK Used to check if it is ok to performe the backup specified in this backup module. If it is ok it should return 0 if not it should return 1.
BACKUP_ACTION Is used to specify actions performed before the actual backup is preformed.
RESTORE_ACTION Is used to specify what to do after a restore is performed.

Here is an example of how a backup module could look like:

Schedule backups

To setup cron to execute this script you need to edit the following file.

/etc/cron.d/op5backup

For backups every day at 01.59 enter the following:

59 1 * * * root /usr/sbin/op5-backup >/dev/null 2>&1

For more information about the cron file execute the following command:

man 5 crontab

Silent backup

It is possible to do a backup without any output from the backup script.

# op5-backup -b

To view the backup log during the backup use the following command

# tail -f /var/log/cron

Migration

OP5 migration backup is a option when migrating configuration to a new major release of OP5 System, for example when moving from APS 3 to APS 6.

To run a migration use the op5-backup script with the -g argument. No other arguments is needed when using the migration option, it will use the backup configuration.

The migration backup files will have a migration_ as a prefix to the file name.

When upgrading/reinstalling a system using the migrate option make sure to move the backup file from the server before erasing the filesystem.

Interactive backup

To run a interactive backup with a graphical interface use the op5-backup -i argument. With the ncurses GUI you will be asked a couple of questions on how and where to backup.

In the interactive backup you will have the option to do migration and normal backup.

Backup verification

To verify a backup file, which is always a good idea run the following command:

# tar vft <op5-backup_file>

This will list all files in the backup file. If no files are listed the backup file might be corrupt.

Override config settings

To override the config file use the op5-backup -o argument. Setting this will make op5-backup ignore the cfg file, default /etc/op5-backup/main.cfg.

Then you need to set at least:

-t, -d, -s, -u

See Backup arguments for more info.

Backup arguments

Argument Description
-t local|ftp|stfp Transfer type to the storage where the backup file will be saved.
-d <any/dir/> The directory where to save the backup file. Valid for all transfer types.
-s <remote.host> Remote server to connect to.
-u <user_name> User name when -t is set to ftp or sftp.
-p <password> Password to use when -t is set to ftp or sftp. If you don't set -p <password> as an argument you will be asked for it.

Restore backups

To restore a backup, execute the op5restore.sh script with the backup-file as argument:

/usr/sbin/op5-restore [-h] -b backup_file [ -f ] [module...]

Options:

-h, shows this help

-b, the path to backup file to restore from

-f, restore files only. Do not execute any post-restore actions, such as restoring DB from dump.

Upgrade system via Internet

If your OP5 Appliance system has HTTP connection to the Internet you can perform your upgrades directly with the yum command. Yum will get the files and data from the OP5 repos.

To upgrade with the OP5 repos

Log in, as the root user, to the server either directly on the console or via ssh.

Perform the upgrade with:

# yum upgrade
# yum clean all
# yum upgrade

Upgrade system from iso file

If your OP5 Appliance system hos no connection to the Internet you can still upgrade the system. All you have to do is to download the latest OP5 Appliance system iso file.

To upgrade with the OP5 Appliance system iso file

  1. Create a CD-Rom from the iso file.
  2. Insert the CD-Rom into your server.
  3. Log in, as the root user, to the server either directly on the console or via ssh.
  4. Create the folder /mnt/cdrom, if it does not exists.
    mkdir /mnt/cdrom
  5. Mount the CD-Rom
    mount -o loop /dev/cdrom /mnt/cdrom
  6. Execute the following command line to perform the upgrade
    yum --disablerepo=* --enablerepo=op5-media \ -c /mnt/cdrom/yum-media.conf update
  7. Unmount and eject the CD-Rom
    umount /mnt/cdrom ; eject

Useful commands

Command Description
cd Change directory
pwdshow Display current directory
ls List directory contents
rm Delete a file or directory
mv Move or rename a file or directory
tail Show the last 10 rows in a file, useful for viewing logs, tail -f to follow/trace a file
less Show the contents of a file
man Show manual page
vi A text editor
jed Another text editor