Skip to main content

Posts

Showing posts from July, 2022

Systemd - Scheduling tasks using timers

Systemd-Timers are a more flexible alternative to cronjobs. For example, Systemd will take care of the dependencies and the logging of your timer whereas with cron you'd have to program it yourself. In this example, I will use systemd-timers to create a backup of the zabbix PostgreSQL database. First, create the service that will actually run the task: [root@zabbix ~]# cat << EOF >> /etc/systemd/system/zabbix-db-backup.service [Unit] Description=Create a Backup of the zabbix database After=network-online.target postgresql.service [Service] Type=simple Nice=19 ExecStart=/usr/bin/sh /root/scripts/zabbix-db-backup.sh User=root Group=root EOF Now create the timer unit which is responsible for scheduling your service: [root@zabbix ~]# cat << EOF >> /etc/systemd/system/zabbix-db-backup.timer [Unit] Description=Timer for zabbix-db-backup.service [Timer] OnCalendar=*-*-* *:45:00 Unit=zabbix-db-backup.service Persiste...

Networking - Set MTU using nmcli

When debugging network-related Issues, it might be helpful to set the MTU to a static value instead of leaving it on 'auto'. On Distros that utilize NetworkManager, this can easily be done using 'nmcli'. Here's a simple configuration for a previously unconfigured interface called 'eno1': [root@server ~]# nmcli connection modify eno1 802-3-ethernet.mtu 1518 [root@server ~]# nmcli connection modify eno1 ipv4.address 192.0.2.5/24 [root@server ~]# nmcli connection modify eno1 ipv4.method manual [root@server ~]# nmcli connection modify eno1 ipv6.method ignore [root@server ~]# nmcli connection up eno1 This will set the MTU, a static IP address, and ignore any ipv6 addressing. Now that the interface is up, check the MTU using the 'ip' command: [root@server ~]# ip -s -c -h link show eno1 | egrep -i 'mtu' 6: eno1: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1518 qdisc mq state UP mode DEFAULT group default qlen 1000 As you can s...

Foreman - Upgrade to Foreman 3.3 and Katello 4.5

NOTE: This guide exists for Upgrading from v3.1 to v3.2 as well --> here When updating your foreman installation manually, I find that the official documentation  is a bit lacking. So here's how I update my foreman-server from v3.2 to v3.3 and katello from v4.4 to v4.5. I would recommend executing all of these commands in a tmux session so that your session will remain on the server in case anything happens to your workstation. Start by checking for running tasks that would prohibit an update: [root@katello01 ~]# foreman-rake katello:upgrade_check Next, update the katello host and reboot it if yum tells you to: [root@katello01 ~]# yum -d 2 -y update [root@katello01 ~]# needs-restarting -r When the katello services have started again, upgrade the repository: [root@katello01 ~]# yum -d 2 -y install https://yum.theforeman.org/releases/3.3/el7/x86_64/foreman-release.rpm [root@katello01 ~]# yum -d 2 -y install https://yum.theforeman.org/katello/4.5/katello/el7/x86_64/kat...