• Skip to main content

Uly.me

cloud engineer

  • Home
  • About
  • Archives

reboot

Ubuntu Check Reboot Required

July 17, 2021

Check if reboot is required in Ubuntu.

at /var/run/reboot-required
*** System restart required ***

at /var/run/reboot-required *** System restart required ***

Filed Under: Linux Tagged With: reboot, required, ubuntu

Check Reboot After Updates

July 16, 2021

Here’s the command to check if the system needs a reboot after running yum update.

Must be root or run it sudo.

$ needs-restarting -r ; echo $?
Core libraries or services have been updated:
  openssl-libs -> 1:1.0.2k-21.el7_9
  kernel -> 3.10.0-1160.31.1.el7
  dbus -> 1:1.10.24-15.el7
  linux-firmware -> 20200421-80.git78c0348.el7_9
  glibc -> 2.17-324.el7_9
  systemd -> 219-78.el7_9.3
 
Reboot is required to ensure that your system benefits from these updates.
 
More information:
https://access.redhat.com/solutions/27943
1

$ needs-restarting -r ; echo $? Core libraries or services have been updated: openssl-libs -> 1:1.0.2k-21.el7_9 kernel -> 3.10.0-1160.31.1.el7 dbus -> 1:1.10.24-15.el7 linux-firmware -> 20200421-80.git78c0348.el7_9 glibc -> 2.17-324.el7_9 systemd -> 219-78.el7_9.3 Reboot is required to ensure that your system benefits from these updates. More information: https://access.redhat.com/solutions/27943 1

In this instance, it requires a reboot due to a new kernel.

Filed Under: Linux Tagged With: centos, check, reboot, redhat, update

Reboot Instance Script

December 21, 2020

Here’s a new script to reboot a Lightsail instance based on input.

#!/bin/bash
echo 'Choose a server to reboot ...'
echo '1) server-one'
echo '2) server-two'
echo '3) server-three'
echo '4) server-four'
echo '5) sever-five'
echo 'q) Quit'
read -p 'Choose a server to reboot: ' server
case $server in 
	1)
		echo 'Rebooting server-one ...'
		aws lightsail reboot-instance --instance-name server-one
		echo 'Done'
		;;
	2)
	        echo 'Rebooting server-two ...'
		aws lightsail reboot-instance --instance-name server-two
		echo 'Done'
		;;
	3)
		echo 'Rebooting server-three ...'
		aws lightsail reboot-instance --instance-name server-three
		echo 'Done'
		;;
	4)
		echo 'Rebooting server-four ...'
		aws lightsail reboot-instance --instance-name server-four
		echo 'Done'
		;;
	5)
		echo 'Rebooting server-five ...'
		aws lightsail reboot-instance --instance-name server-five
		echo 'Done'
		;;
	q)
		echo 'Quit'
		;;
	*)
		echo 'Invalid option' $server
		;;
esac

#!/bin/bash echo 'Choose a server to reboot ...' echo '1) server-one' echo '2) server-two' echo '3) server-three' echo '4) server-four' echo '5) sever-five' echo 'q) Quit' read -p 'Choose a server to reboot: ' server case $server in 1) echo 'Rebooting server-one ...' aws lightsail reboot-instance --instance-name server-one echo 'Done' ;; 2) echo 'Rebooting server-two ...' aws lightsail reboot-instance --instance-name server-two echo 'Done' ;; 3) echo 'Rebooting server-three ...' aws lightsail reboot-instance --instance-name server-three echo 'Done' ;; 4) echo 'Rebooting server-four ...' aws lightsail reboot-instance --instance-name server-four echo 'Done' ;; 5) echo 'Rebooting server-five ...' aws lightsail reboot-instance --instance-name server-five echo 'Done' ;; q) echo 'Quit' ;; *) echo 'Invalid option' $server ;; esac

Assuming awscli is working and correct permission is granted to user.

Filed Under: Linux Tagged With: bash, instance, lightsail, reboot

Ansible Run Updates

June 18, 2020

Here’s a simple adhoc to run updates on systems in Ansible.

ansible servers -m apt -a "upgrade=yes update_cache=yes" -b

ansible servers -m apt -a "upgrade=yes update_cache=yes" -b

Results:

server | SUCCESS => {
    "changed": false, 
    "msg": "Reading package lists...
     Building dependency tree...
     Reading state information...
     Calculating upgrade...
     0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.", 
    "stderr": "", 
    "stderr_lines": [], 
    "stdout": "Reading package lists...
     Building dependency tree...
     Reading state information...
     Calculating upgrade...
     0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.", 
    "stdout_lines": [
        "Reading package lists...", 
        "Building dependency tree...", 
        "Reading state information...", 
        "Calculating upgrade...", 
        "0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded."
    ]
}

server | SUCCESS => { "changed": false, "msg": "Reading package lists... Building dependency tree... Reading state information... Calculating upgrade... 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.", "stderr": "", "stderr_lines": [], "stdout": "Reading package lists... Building dependency tree... Reading state information... Calculating upgrade... 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.", "stdout_lines": [ "Reading package lists...", "Building dependency tree...", "Reading state information...", "Calculating upgrade...", "0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded." ] }

If you want to reboot a remote server.

ansible servers -m "reboot" -b

ansible servers -m "reboot" -b

Filed Under: Cloud, Linux Tagged With: adhoc, ansible, reboot, updates, upgrades

AWS EFS /etc/fstab

December 23, 2019

To automatically mount a EFS volume after each reboot, you’ll need to add the following format to /etc/fstab.

You can use the DNS name given by AWS.

fs-12345678:/ /mnt/efs efs defaults,_netdev 0 0

fs-12345678:/ /mnt/efs efs defaults,_netdev 0 0

Or the IP address.

10.0.0.22:/ /mnt/efs efs defaults,_netdev 0 0

10.0.0.22:/ /mnt/efs efs defaults,_netdev 0 0

Mount all with fake and verbose.

mount -fav

mount -fav

Filed Under: Cloud Tagged With: automatic, aws, efs, fstab, mount, reboot

  • Home
  • About
  • Archives

Copyright © 2023