Need help to fix weird reboot

Hello
I have installed NUT on my Raspberry Pi to monitor my UPS and it was working fine since a recent OSMC update.

When there’s a power failure the UPS shutdown the RPI. That’s OK.
But when the power comes back, the RPI restart
and then, after exactly 10 mn, it reboots.

I think this issue began with after April’s OSMC update (not sure).

How can I know the origin of this reboot?

Would be good to get some logs from when it reboots.
Did you alter the crontab file?

The log is provided by MyOSMC.
Is it the one you need?

Did I alter the crontab file?
No. In MyOSMC I just use Crontab to manage daily backups.

Can you post your crontab? Also, does the pi actually reboot or just restart kodi?

Looks like the ups has some communication problems with the rpi. Are all connections good and all config files set correctly?

Also does it reboot after ten minutes without the ups connected?

Well i don’t know to do it.:disappointed:

I suppose so. I have followed this tutorial. Didn’t notice there were issues with the UPS.
I’m gonna check all today.

The RPI is always connected to the UPS.

cat /etc/crontab

No such file or directory

And sorry.
I gave you a bad log.
This is the good one.

crontab -e is the best way to configure cron

cron is in the app store

Okey.
Done.
This is what I got:

/etc/crontab: system-wide crontab

Unlike any other crontab you don’t have to run the `crontab’

command to install the new version when you edit this file

and files in /etc/cron.d. These files also have username fields,

that none of the other crontabs do.

SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

m h dom mon dow user command

17 * * * * root cd / && run-parts --report /etc/cron.hourly
25 6 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
47 6 * * 7 root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
52 6 1 * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )

Just to rule out that it is a general problem, could you please let the ups power down your raspberry and then start it up by plugging it into the wall socket directly without any connection to the ups?

Also, what else is connected to the usv? The router maybe?

Done.
After 10 mn wait the RPI didn’t reboot.

To the USV is connected:

  • the TV
  • a switch
  • a NAS
    and the RPI.

Back.
When calling
osmc@osmc:~$ systemctl status

I got this:

* osmc
    State: degraded
     Jobs: 0 queued
   Failed: 1 units
    Since: Thu 1970-01-01 01:00:06 CET; 46 years 4 months ago
   CGroup: /
           |-1 /sbin/init
           |-system.slice
           | |-avahi-daemon.service
           | | |-299 avahi-daemon: running [osmc.local
           | | `-303 avahi-daemon: chroot helpe
           | |-dbus.service
           | | `-300 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation
           | |-nut-server.service
           | | `-500 /lib/nut/upsd
           | |-udisks.service
           | | |-325 /usr/lib/udisks/udisks-daemon --no-debug
           | | `-329 udisks-daemon: not polling any devices
           | |-cron.service
           | | `-297 /usr/sbin/cron -f
           | |-wpa_supplicant.service
           | | `-402 /sbin/wpa_supplicant -u -s -O /run/wpa_supplicant
           | |-mediacenter.service
           | | |-343 /bin/bash /usr/bin/mediacenter
           | | |-388 sudo -u osmc /usr/lib/kodi/kodi.bin --standalone -fs --lircdev /var/run/lirc/lircd
           | | `-395 /usr/lib/kodi/kodi.bin --standalone -fs --lircdev /var/run/lirc/lircd
           | |-systemd-journald.service
           | | `-190 /lib/systemd/systemd-journald
           | |-connman.service
           | | `-308 /usr/sbin/connmand -n --nodnsproxy --config=/etc/connman.conf
           | |-ssh.service
           | | `-334 /usr/sbin/sshd -D
           | |-systemd-logind.service
           | | `-298 /lib/systemd/systemd-logind
           | |-system-lircd_helper.slice
           | | `-lircd_helper@lirc0.service
           | |   `-306 /usr/sbin/lircd --driver=default --device=/dev/lirc0 --uinput --output=/var/run/lirc/lircd-lirc0 --pidfile=/var/run/lirc/lircd-
           | |-systemd-udevd.service
           | | `-216 /lib/systemd/systemd-udevd
           | |-udisks-glue.service
           | | `-317 /usr/bin/udisks-glue --foreground
           | |-polkitd.service
           | | `-394 /usr/lib/policykit-1/polkitd --no-debug
           | |-rpcbind.service
           | | `-398 /sbin/rpcbind -w
           | |-nut-driver.service
           | | `-494 /lib/nut/usbhid-ups -a eaton
           | |-irqbalance.service
           | | `-301 /usr/sbin/irqbalance
           | |-nmbd.service
           | | `-474 /usr/sbin/nmbd -D

Is there a clue somewhere or anything wrong in it?

EDIT:
here’s the faulty service I think:

osmc@osmc:~$ systemctl list-units --failed
  UNIT             LOAD   ACTIVE SUB    DESCRIPTION
* rc-local.service loaded failed failed /etc/rc.local Compatibility

osmc@osmc:~$ systemctl list-units  --all |grep failed
* rc-local.service                                                                                                        loaded    failed   failed    /etc/rc.local Compatibility

So what’s wrong with:

#!/bin/sh -e

rc.local

This script is executed at the end of each multiuser runlevel.

Make sure that the script will “exit 0” on success or any other

value on error.

In order to enable or disable this script just change the execution

bits.

By default this script does nothing.

sleep 5
/usr/bin/curl “https://-mobile.com/sendmsg?user=19&pass=je&msg=Raspberry%20on%20line” exit 0

EDIT:
Fixed by having a call in rc.local to an external script

You have exit 0 on the end of the same line which is invalid syntax in bash.

A new statement must be on a new line, otherwise separate it with a semicolon.