Converting IBM Storage Protect server and storage agent services from System V to systemd

The scripts that are used to automatically start the server and storage agent on Linux operating systems were originally on the System V initialization system. The later versions of Linux are in systemd format. Compatibility code is available to support the previous System V scripts. However, it is preferable to move to the systemd initialization system.

Before you begin

The conversion script can be used on the following operating systems:
  • Red Hat Enterprise Linux 7 and later
  • SUSE Linux Enterprise Server 12
  • Ubuntu version 13.04

About this task

You can run a shell script to convert the services for server instances and the storage agent from System V to systemd. If the script does not work in your system environment, you can convert the services manually. For instructions, see Manually converting server instance services from System V to systemd and Manually converting a storage agent service from System V to systemd.

Procedure

To convert System V initialization services to systemd services, run the following script:
ConvertInitToSystemd.sh

To use the script, see the following instructions:

./ConvertInitToSystemd.sh [-c | -p] [-D][-d dir][-h][-H][-s][-S]
   -c - Convert the server instance or storage agent service from the System V operating system to systemd (a system and service manager).  The -c option cannot be used with the -p   option.
   -D - Enable debug mode, which turns on tracing.
   -d <dir> - Specify the installation directory for the server or storage agent.
              Example:  -d /opt/tivoli/tsm
   -h -H - Display usage.
   -p - Generate a preview. Similar to the convert option, but
       displays only commands and output. No service conversion occurs.
   -s - Specify the server instance service. Must be used with either the -c or -p option.
   -S - Specify the storage agent service. Must be used with either the -c or -p option.

Manually converting server instance services from System V to systemd

The preferred method for converting an IBM Storage Protect server instance from System V to systemd is to run the ConvertInitToSystemd.sh script. However, if the script does not run in your system environment, follow the manual instructions for converting the instance service.

Before you begin

Ensure that you have either the /usr/bin/systemic or /bin/systemctl utility on your system.

Procedure

  1. Collect all of the server instances that are on the system by running the db2ilist command:
    install_dir/db2/bin/db2ilist

    where install_dir specifies the installation directory. For example, if the installation directory is /opt/tivoli/tsm, run the following command:

    /opt/tivoli/tsm/db2/bin/db2ilist

    The command output is similar to the following example:

    tsminst1
  2. Complete the following steps for each server instance that exists on the system.

    The examples use the default values, where the instance name is tsminst1 and the installation directory is /opt/tivoli/tsm.

    Remove the service by running the following command:

    chkconfig --del instance_name

    where instance_name specifies the name of the instance, for example:

    chkconfig --del tsminst1

  3. If the chkconfig command fails, run the following command:
    insserv -r script_name

    where script_name specifies the name of the script, for example:

    insserv -r /etc/init.d/tsminst1

  4. To start creating the systemd instance script service, move the instance script from the /etc/init.d directory to the install_dir/server/bin directory, for example:

    mv /etc/init.d/tsminst1 /opt/tivoli/tsm/server/bin

  5. Run the following command:
    chmod +x install_dir/server/bin/instance_script

    The command is similar to the following example:

    chmod +x /opt/tivoli/tsm/server/bin/tsminst1

  6. In the /etc/systemd/system directory, create a file with the following name:
    instance_name.service

    Run a command that is similar to the following example:

    vi/etc/systemd/system/tsminst1.service

    The content of the file is similar to the following example:

    [Unit]
    Description=IBM Storage Protect Server instance tsminst1
    [Service]
    TasksMax=infinity
    Type=oneshot
    RemainAfterExit=true
    ExecStart=/opt/tivoli/tsm/server/bin/tsminst1 start
    ExecStop=/opt/tivoli/tsm/server/bin/tsminst1 stop
    ExecReload=/opt/tivoli/tsm/server/bin/tsminst1 restart
    [Install]
    WantedBy=multi-user.target
  7. Save the service file.
  8. Run the following command:
    systemctl daemon-reload
  9. Create a symbolic link from the script in the /etc/systemd/system directory to the /etc/systemd/system/multi-user.target.wants directory.
    Run a command that is similar to the following example:

    ln -s /etc/systemd/system/tsminst1.service

    /etc/systemd/system/multiuser.target.wants/tsminst1.service

  10. Run the following command:
    systemctl enable serviceName
    The command is similar to the following example:

    systemctl enable tsminst1.service

Manually converting a storage agent service from System V to systemd

The preferred method for converting an IBM Storage Protect storage agent service from System V to systemd is to run the ConvertInitToSystemd.sh script. However, if the script does not run in your environment, you can convert the storage agent service manually.

Before you begin

Ensure that you have either the /usr/bin/systemctl or /bin/systemic utility on your system.

About this task

The examples use the default installation directory: /opt/tivoli/tsm.

Procedure

  1. To remove the System V service, run the following command:
    chkconfig --del dsmsta.rc
  2. If the chkconfig command fails, run the insserv command:
    insserv -r /etc/init.d/dsmsta.rc
  3. Move the storage agent script from the /etc/init.d directory to the following directory:
    install_dir/StorageAgent/bin/service

    If the install_dir/StorageAgent/bin/service directory does not exist, create the directory, for example:

    mkdir/opt/tivoli/tsm/StorageAgent/bin/service

  4. Run the following command:
    chmod +x install_dir/StorageAgent/bin/service/dsmsta.rc
    The command is similar to the following example:

    chmod +x /opt/tivoli/tsm/StorageAgent/bin/service/dsmsta.rc

  5. In the /etc/systemd/system directory, create a file with the following name:
    dsmsta.service
    The command is similar to the following example:

    vi /etc/systemd/system/dsmsta.service

    The content of the file is similar to the following example:

    [Unit]
    Description=IBM Storage Protect Server Storage Agent
    [Service]
    TasksMax=infinity
    Type=oneshot
    RemainAfterExit=true
    ExecStart=/opt/tivoli/tsm/StorageAgent/bin/service/dsmsta.rc start
    ExecStop=/opt/tivoli/tsm/StorageAgent/bin/service/dsmsta.rc stop
    ExecReload=/opt/tivoli/tsm/StorageAgent/bin/service/dsmsta.rc restart
    [Install]
    WantedBy=multi-user.target
    
  6. Save the service file.
  7. Run the following command:
    systemctl daemon-reload
  8. Create a symbolic link from the script in the /etc/systemd/system directory to the /etc/systemd/system/multi-user.target.wants directory.
    Run the following command:
    ln -s /etc/systemd/system/dsmsta.service /etc/systemd/system/multiuser.target.wants/dsmsta.service
  9. Run the following command:
    systemctl enable dsmsta.service