Linux operating systems

Automatically starting servers on Linux systems

You can automatically start a server on a Linux® operating system by using the systemd or System V initialization system.

Automatically starting the server by using systemd initialization

To automatically start a server on a Linux® operating system by using the systemd initialization system, configure and run the dsmserv.rc script.

Before you begin

Ensure that either the /usr/bin/systemctl or the /bin/systemctl utility is installed on the system.

Ensure that the server instance runs under a nonroot user ID with the same name as the instance owner.

About this task

You can use the dsmserv.rc script to automatically start or stop a server instance.

Procedure

For each server instance that you want to automatically start, complete the following steps:

  1. Rename the dsmserv.rc script to match the name of the server instance owner. For example, if the server instance owner is tsminst1 and the file is saved in the install_dir/server/bin directory, issue the following command:
    cp /opt/tivoli/tsm/server/bin/dsmserv.rc /opt/tivoli/tsm/server/bin/tsminst1
  2. Set execute permissions on the newly renamed script by running the following command:.
    chmod +x install_dir/server/bin/instance
    For example:
    chmod +x /opt/tivoli/tsm/server/bin/tsminst1
  3. If the server instance directory is not home_directory/tsminst1, locate the following line in the script copy:
    instance_dir="${instance_home}/tsminst1"

    Change the line to point it to your server instance directory. For example:

    instance_dir="/tsminst1"
  4. In the script copy, locate the following line:
    # pidfile: /var/run/dsmserv_instancename_su.pid

    Change the instance name value to the name of the server instance owner. For example, if the server instance owner is tsminst1, update the line by issuing the following command:

    # pidfile: /var/run/dsmserv_tsminst1_su.pid
  5. Create an instance.service file in the /etc/systemd/system directory.

    For example:

    vi /etc/systemd/system/tsminst1.service

    The file contains the following content:

    [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
    
  6. Save the service file and run the following command:
    systemctl daemon-reload
  7. Create a symbolic link from the script in the /etc/systemd/system directory to the /etc/systemd/system/multi-user.target.wants directory. For example:
    ln -s /etc/systemd/system/tsminst1.service  /etc/systemd/system/multi-user.target.wants/tsminst1.service
  8. To enable the systemd initialization service, run the following command:
    systemctl enable service_name

    For example:

    systemctl enable tsminst1.service

Automatically starting the server by using System V initialization

To automatically start a server on a Linux operating system by using the System V initialization system, configure and run the dsmserv.rc script.

Before you begin

Ensure that kernel parameters are set correctly.

Ensure that the server instance runs under the instance owner user ID.

Ensure that access rights and user limits are set correctly.

About this task

The dsmserv.rc script is in the server installation directory, for example, /opt/tivoli/tsm/server/bin.

The dsmserv.rc script can be used either to start the server manually or to start the server automatically by adding entries to the /etc/rc.d/init.d directory. The script works with Linux utilities such as CHKCONFIG and SERVICE.

Procedure

For each server instance that you want to automatically start, complete the following steps:

  1. Place a copy of the dsmserv.rc script in the /init.d directory, for example, /etc/rc.d/init.d.

    Ensure that you change only the copy of the script. Do not change the original script.

  2. Rename the script copy so that it matches the name of the server instance owner, for example, tsminst1.

    The script was created under the assumption that the server instance directory is home_directory/tsminst1, for example: /home/tsminst1/tsminst1.

  3. If the server instance directory is not home_directory/tsminst1, locate the following line in the script copy:
    instance_dir="${instance_home}/tsminst1"
    Change the line so that it points to your server instance directory, for example:
    instance_dir="/tsminst1"
  4. In the script copy, locate the following line:
    # pidfile: /var/run/dsmserv_instancename_su.pid
    Change the instance name value to the name of the server instance owner.
    For example, if the server instance owner is tsminst1, update the line as shown:
    # pidfile: /var/run/dsmserv_tsminst1_su.pid
  5. Configure the run level at which the server automatically starts. By using tools such as the CHKCONFIG utility, specify a value that corresponds to a multiuser mode with networking turned on. Typically, the run level to use is 3 or 5, depending on the operating system and its configuration. For more information about multiuser mode and run levels, see the documentation for your operating system.
  6. To start the server, issue the following command:
    service server_instance_owner start

    For example, if the server instance owner is tsminst1, you would issue the following command:

    service tsminst1 start

  7. To stop the server, issue the following command:
    service server_instance_owner stop

    For example, if the server instance owner is tsminst1, you would issue the following command:

    service tsminst1 stop

Example

This example uses the following values:
  • The instance owner is tsminst1.
  • The server instance directory is /home/tsminst1/tsminst1.
  • The dsmserv.rc script copy is named tsminst1.
  • The CHKCONFIG utility is used to configure the script to start at run levels 3, 4, and 5.
cp /opt/tivoli/tsm/server/bin/dsmserv.rc /etc/rc.d/init.d/tsminst1
sed -i 's/dsmserv_instancename.pid/dsmserv_tsminst1.pid/' /etc/rc.d/init.d/tsminst1
chkconfig --list tsminst1
service tsminst1 supports chkconfig, but is not referenced in
any runlevel (run 'chkconfig --add tsminst1')
chkconfig --add tsminst1
chkconfig --list tsminst1
tsminst1 0:off 1:off 2:off 3:off 4:off 5:off 6:off
chkconfig --level 345 tsminst1 on
chkconfig --list tsminst1
tsminst1 0:off 1:off 2:off 3:on 4:on 5:on 6:off