v18 no setwakeup.sh on poweroff
#1
On freshly installed ubuntu server 18.04 with kodi v18 (alpha3) and tvheadend the setwakeup.sh does not run on poweroff.

The script lives in standard path /usr/bin and works fine when starting manually.
There is no hint in kodi.log about trying to run setwakeup.sh.
Is there anyone who can help, or do I have to report a bug report?
Thanks in advance

---
#!/bin/sh
#
# set ACPI Wakeup time
# usage: setwakeup.sh seconds
#    seconds - number of seconds from epoch to UTC time (time_t time format)

echo 0 > /sys/class/rtc/rtc0/wakealarm  # clear alarm
echo $1 > /sys/class/rtc/rtc0/wakealarm # write the waketime
---
Reply
#2
I found out why it didn't work. I had to do the following tasks.

1.) Add file kodi to /etc/sudoers.d with content
kodi ALL = NOPASSWD: /usr/bin/setwakeup.sh

2.) Add wakeup command in kodi pvr power settings as follows
sudo /usr/bin/setwakeup.sh

For security reason I recommend to chmod 0440 /etc/sudoers.d/kodi
as described in /etc/sudoers.d/README

The information in kodi wiki is misleading and irritating.
Settings/TV/Power_saving (wiki)

1.3 Wakeup command
Settings level:Advanced
Description:The command to execute. Defaults to '/usr/bin/setwakeup.sh'.

I've checked the source code with git and grep. But I did not found any implementation of a default value for Wakeup Command.

I hope this post will help people fighting with the same issue.

Have fun :-)
Reply
#3
Wouldn't 'sudo chmod 755 /usr/bin/setwakeup.sh' have been a better solution ?  Gives all users execute access to that file without adding them to sudo (or needing it) but no editing allowed.
Learning Linux the hard way !!
Reply
#4
(2018-08-31, 20:37)black_eagle Wrote: Wouldn't 'sudo chmod 755 /usr/bin/setwakeup.sh' have been a better solution ?  Gives all users execute access to that file without adding them to sudo (or needing it) but no editing allowed.
 No that would not be sufficient, and was already set. The execution of the command itself was not the problem. But the command needs the access rights to alter /sys/class/rtc/rtc0/wakealarm.

$ ll /sys/class/rtc/rtc0/wakealarm
-rw-r--r-- 1 root root 4096 Sep  1 08:31 /sys/class/rtc/rtc0/wakealarm

Therefore the root rights are needed. So I think to give the root rights to one command will be a good way to go.
Reply
#5
Ah, fair enough.  I didn't consider the permissions of the file you need to alter.  Hate doing anything as 'root' but yeah, sometimes there's just no avoiding it.
Learning Linux the hard way !!
Reply

Logout Mark Read Team Forum Stats Members Help
no setwakeup.sh on poweroff0