Customizing the Message of the Day (MOTD)
Virtuozzo Server can display an informative message, known as the message of the day (MOTD), when a user logs in to the server. As a root user, you can customize the MOTD according to your needs, for example, to show a greeting, important system information, current resource consumption, or something else.
The vz-motd service generates the message of the day from the contents of the /etc/motd_user and /etc/motd files. The steps to customize these files differ depending on whether you want the MOTD to show static or dynamic information. They are described in the following sections.
Setting a Custom Static MOTD
To set the MOTD to display static information, for example, a greeting, do the following:
Add the desired text to the
/etc/motd_userfile. For example:1echo 'Welcome to Virtuozzo Server' >> /etc/motd_userRestart the Virtuozzo Server MOTD service:
1systemctl restart vz-motd
On the next successful login, you will see the following static message of the day:
| |
Setting a Custom Dynamic MOTD
To set the MOTD to display dynamic information, for example, the current Virtuozzo Server release and kernel versions as well as license status, do as follows:
Create the
/etc/vz/ifup.ddirectory and a shell script with a custom name in it, for example,motd.sh:1 2mkdir /etc/vz/ifup.d vi /etc/vz/ifup.d/motd.shAdd the following lines to the script:
1 2 3 4 5 6 7 8 9#! /bin/bash echo -e " Welcome to `cat /etc/virtuozzo-release` vzkernel: `uname -r` License: `vzlicview | grep -E "(status|expiration)"` " >> /etc/motd chmod 644 /etc/motdMake the script executable:
1chmod 755 /etc/vz/ifup.d/motd.shRestart the Virtuozzo Server MOTD service:
1systemctl restart vz-motd
On the next successful login, you can see a message of the day similar to the following:
| |