# needs-restarting alternative on SLES 12?

**URL:** <https://forums.suse.com/t/needs-restarting-alternative-on-sles-12/34698>\
**Category:** SLES Configure-Administer\
**Created:** [January 15, 2020, 4:16pm UTC](https://forums.suse.com/t/needs-restarting-alternative-on-sles-12/34698 "2020-01-15T16:16:47Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Raffx](https://avatars.discourse-cdn.com/v4/letter/r/a5b964/32.png) [@Raffx](https://forums.suse.com/u/Raffx)\
**Post date:** [January 15, 2020, 4:16pm UTC](https://forums.suse.com/t/needs-restarting-alternative-on-sles-12/34698/1 "2020-01-15T16:16:47Z")

</div>

I’m searching for something that let’s me know whether or not my system would need a reboot (kernel update etc). Red Hat has the yum/dnf plugin needs-restarting, SUSE15 has ported this over as well and it’s available since 15.1. Debian/Ubuntu have the file /var/run/reboot-required and if that exists a reboot is required.

But I couldn’t find anything on SLES 12 that let’s me check this in a script.

The ultimate goal is to build this into our update management with ansible. Updates get installed and if a reboot is required, it’s done as well.

Someone got an idea?

---

<div class="post-metadata">

**Author:** ![malcolmlewis](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/malcolmlewis/32/11375_2.png) [@malcolmlewis](https://forums.suse.com/u/malcolmlewis)\
**Post date:** [January 16, 2020, 12:35am UTC](https://forums.suse.com/t/needs-restarting-alternative-on-sles-12/34698/2 "2020-01-16T00:35:33Z")

</div>

[QUOTE=Raffx;59217]I’m searching for something that let’s me know whether or not my system would need a reboot (kernel update etc). Red Hat has the yum/dnf plugin needs-restarting, SUSE15 has ported this over as well and it’s available since 15.1. Debian/Ubuntu have the file /var/run/reboot-required and if that exists a reboot is required.

But I couldn’t find anything on SLES 12 that let’s me check this in a script.

The ultimate goal is to build this into our update management with ansible. Updates get installed and if a reboot is required, it’s done as well.

Someone got an idea?[/QUOTE]  
Hi and welcome to the Forum 🙂  
After an update the output from the command zypper ps -s will output if core libraries have been updated and a reboot is required. Dare I say look at the man page for zypper 😉

There are exit codes;

```auto
102 - ZYPPER_EXIT_INF_REBOOT_NEEDED
           Returned after a successful installation of a patch which requires reboot of computer.
```

The current releases have a file /etc/zypp/needreboot where files that are updated can trigger a reboot request.

---

<div class="post-metadata">

**Author:** ![Raffx](https://avatars.discourse-cdn.com/v4/letter/r/a5b964/32.png) [@Raffx](https://forums.suse.com/u/Raffx)\
**Post date:** [January 16, 2020, 9:20am UTC](https://forums.suse.com/t/needs-restarting-alternative-on-sles-12/34698/3 "2020-01-16T09:20:23Z")

</div>

> [@malcolmlewis;59220](#):
>
> the command zypper ps -s will output if core libraries have been updated and a reboot is required.
> 
> There are exit codes;
> 
> ```auto
> 102 - ZYPPER_EXIT_INF_REBOOT_NEEDED
> Returned after a successful installation of a patch which requires reboot of computer.
> ```

Thanks for your reply. I know about zypper ps, but as far as I know this is only for services and doesn’t tell me whether or not a full reboot is required, e.g. for a kernel update.

And about the return code, this is only returned after installation of the package right? So you can’t get that return code again after the installation process (I’m not talking about $?)?. Zypper ps doesn’t give that return code either.

The problem is that the installation happens via the zypper ansible module, which doesn’t let you access the return code of the installation process.

---

<div class="post-metadata">

**Author:** ![malcolmlewis](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/malcolmlewis/32/11375_2.png) [@malcolmlewis](https://forums.suse.com/u/malcolmlewis)\
**Post date:** [January 16, 2020, 4:07pm UTC](https://forums.suse.com/t/needs-restarting-alternative-on-sles-12/34698/4 "2020-01-16T16:07:57Z")

</div>

Hi  
The only other place I can think of is /var/log/zypper.log and /var/log/zypp/history for a trigger… I’ve not used ansible, but do note in my SuMA instance it does show systems requiring a reboot…
