Administrative tasks

Overview

You perform basic administrative tasks using command line tools.

Start and stop services

You use chkconfig to specify which programs to start during the boot sequence. It can also show you the current configuration. Some examples are listed below.

Note: The service command only applies to Red Hat Enterprise Linux version 6. If you have upgraded your OP5 Appliance System to version 7, use command systemctl instead. For more information, seen the vendor documentation.

# chkconfig service

Services can start and stop running programs. This is useful, for example, if want to restart OP5 Monitor.

# chkconfig --list

This command lists the programs that are started at boot time. It first lists the program name, and then seven columns that represent different run levels. The only important run level is 3, which is the default run level for OP5 Appliance System.

# chkconfig smsd on
# chkconfig smsd off

This command tells the system to start or stop the smsd program during boot time.

# service monitor stop
# service monitor start

This command starts and stops OP5 Monitor during run time.

Shut down or restart

To shut down the system properly, you need to log on as root and issue the following command:

# shutdown -h now

This shuts down all running programs and then stops the system. After this it is safe to power off the system.

To restart the system, issue a reboot command or press Ctrl-Alt-Delete in the console window.

Back up the system

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

There are several ways to back up the system. Since OP5 Appliance System is based on CentOS 6, most large providers of backup solutions have clients that can be installed on OP5 Appliance System.

op5backup

For Linux systems where there is no backup facility, we provide a backup utility called op5backup that can create backups of system configuration data and OP5 Monitor 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.

op5backup does not back up op5-logserver logs, so you need to set up remote archiving for this, or back them up manually.

To obtain a list of all op5backup functions available, run the following command:

op5-backup --help command

Configuration

The main configuration file for op5backup is in file /etc/op5-backup/main.conf.

You need to set the following configuration variables:

Variable Description
transfer=

The file set this to ftp, sftp or local. If you set this to:

  • local, set storagepath
  • ftp or sftp, set backupserver, backuppath, backupuser, and backuppass
storagepath= Path to local backup storage location.
backupserver= FQDN or IP address of your FTP or SFTP server.
backuppath= Path to remote backup storage location.
backupuser= User name for the FTP or SFTP account.
backuppass= Password for the FTP or SFTP account.

If you have added software or data to your OP5 Appliance System that you want to include in the backup, you need to add it to the /etc/op5-backup/modules/custom file.

The backup modules are written in bash and use 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 single files, file names with wildcards like *, and whole folders.
WORK_DIR The folder where the file is stored temporarily during the backup. Make sure there is enough free space in the specified location.

The following table describes the functions used in an op5-backup module:

Function Description
CHECK Used to check if it is ok to perform the backup specified in this backup module. If it is ok, it returns 0, if not it returns 1.
BACKUP_ACTION Used to specify actions performed before the actual backup is performed.
RESTORE_ACTION Used to specify what to do after a restore is performed.

Schedule backups

To set up cron to execute a backup script you need to edit file /etc/cron.d/op5backup.

For example, 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 perform a backup without any output from the backup script, with the following command:

# op5-backup -b

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

# tail -f /var/log/cron

Migration

You can use migration backup to migrate a configuration to a new major release of OP5 Appliance System, for example when migrating from APS 3 to APS 6.

You can run a migration using the following command:

 op5-backup -g

No other arguments are needed when using the migration option, it uses the backup configuration.

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

When upgrading or reinstalling a system using the migrate option, you need to ensure you move the backup file from the server before erasing the file system.

Interactive backup

To run an interactive backup with a graphical interface, run the following command:

op5-backup -i

This command starts an ncurses user interface, where you can specify how and where to backup. You can choose between migration and normal backup.

Backup verification

To verify a backup file, run the following command:

# tar vft <op5-backup_file>

This lists all the files in the backup file. If no files are listed, the backup file might be corrupt.

Override configuration settings

To override the configuration file, run the following command:

op5-backup -o 

Setting this makes op5-backup ignore the default configuration file, /etc/op5-backup/main.cfg. You can add backup arguments, as described below.

Backup arguments

Argument Description
-t local|ftp|sftp Type of transfer to the storage where the backup file will be saved.
-d <any/dir/> The directory in which 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 do not set -p <password> as an argument, you will be asked for it.

Restore backups

To restore a backup, execute op5-restore with the backup file as an argument:

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

Options:

  • -h — shows this help.
  • -b — the path to the backup file to restore from.
  • -f — restore files only. Do not execute any post-restore actions, such as restoring the database from a dump.