Hi,
I would like to find a way to prevent/disable temporarily the sleep mode on my Linux box while I am accessing data over Samba from my others computers on my network (mostly Windows PCs).
Since I do not use it as a full time server, I don't want my Linux box to be powered on all the time. Furthermore, I can easily power it on again from a simple WOL command.
From what I read, there is no "official" way of doing this.
So far, I found this solution that is quite simple.
http://aikar.co/2011/03/03/ubuntu-prevent-sleep-samba/
The guy proposes basically to check a string in smbstatus to verify if there is a file lock and then simulate a user action to reset the sleep mode timer. However, the command he uses for that, "gnome-screensaver-command --poke" doesn't exist anymore in Gnome 3.
My first try was to replace this by “xset” but it didn't work. I believe that xset have only an impact on the screen and not on the sleep/hibernate state.
From what I read on others sites and from google searches, I would need to use the dbus command to achieve the same thing. However, dbus inhibitor "lives" only as long as the app who called it is running. That means that it cannot be use in the same simple way described in the first example.
I know that I could solve my problem by manually disable the sleep/hibernate mode via VNC each time I need to access Samba. But as they say, there must be a better way.
My questions are:
1- Is there a simple and clean way to automatically disable temporarily the sleep mode when certain applications are running (i.e. Samba) and then resume normally? I would prefer not reinventing the wheel.
2- If not, could you help me to figure out a way to do it with dbus?
3- Is a software like qbittorent, for example, use dbus
to achieve this or is there another way?
Last piece of information: I also use my my Linux box locally (with mouse and keyboard). That means that “NOT using samba” should not automatically triggers the sleep mode.
Thank you *VERY MUCH*
----------------------------------
Sosigene
Bookmarks