Exec a command before and after suspeding

View: New views
5 Messages — Rating Filter:   Alert me  

Exec a command before and after suspeding

by Frittella Laurento-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Can g-p-m exec a custom command before and after suspend without root
privileges?
If I use OnSuspend and OnResume in the hibernate configuration the
command will start with root privileges and it doesn't work as it should
(I want to interact with some applications using the DBus session of the
user that runs g-p-m).

Thanks in advance,
Laurento
_______________________________________________
gnome-power-manager-list mailing list
gnome-power-manager-list@...
http://mail.gnome.org/mailman/listinfo/gnome-power-manager-list

Re: Exec a command before and after suspeding

by Peter Jones-18 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wed, 2006-12-13 at 13:29 +0100, Frittella Laurento wrote:
> Can g-p-m exec a custom command before and after suspend without root
> privileges?
> If I use OnSuspend and OnResume in the hibernate configuration the
> command will start with root privileges and it doesn't work as it should
> (I want to interact with some applications using the DBus session of the
> user that runs g-p-m).

We don't really have any infrastructure for that yet, unfortunately.
Probably the easiest thing to do is something like what I've done in
http://people.redhat.com/pjones/rhythmbox-pm.tar.bz2

--
  Peter

_______________________________________________
gnome-power-manager-list mailing list
gnome-power-manager-list@...
http://mail.gnome.org/mailman/listinfo/gnome-power-manager-list

Re: Exec a command before and after suspeding

by Richard Hughes :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wed, 2006-12-13 at 11:52 -0500, Peter Jones wrote:

> On Wed, 2006-12-13 at 13:29 +0100, Frittella Laurento wrote:
> > Can g-p-m exec a custom command before and after suspend without root
> > privileges?
> > If I use OnSuspend and OnResume in the hibernate configuration the
> > command will start with root privileges and it doesn't work as it should
> > (I want to interact with some applications using the DBus session of the
> > user that runs g-p-m).
>
> We don't really have any infrastructure for that yet, unfortunately.
> Probably the easiest thing to do is something like what I've done in
> http://people.redhat.com/pjones/rhythmbox-pm.tar.bz2

Peter, shouldn't we just implement the suspend registration interface,
or just send a signal on suspend or resume? Doing this system wide seems
the wrong thing to do.

Richard.

_______________________________________________
gnome-power-manager-list mailing list
gnome-power-manager-list@...
http://mail.gnome.org/mailman/listinfo/gnome-power-manager-list

Re: Exec a command before and after suspeding

by Peter Jones-18 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Sat, 2006-12-16 at 12:14 +0000, Richard Hughes wrote:

> On Wed, 2006-12-13 at 11:52 -0500, Peter Jones wrote:
> > On Wed, 2006-12-13 at 13:29 +0100, Frittella Laurento wrote:
> > > Can g-p-m exec a custom command before and after suspend without root
> > > privileges?
> > > If I use OnSuspend and OnResume in the hibernate configuration the
> > > command will start with root privileges and it doesn't work as it should
> > > (I want to interact with some applications using the DBus session of the
> > > user that runs g-p-m).
> >
> > We don't really have any infrastructure for that yet, unfortunately.
> > Probably the easiest thing to do is something like what I've done in
> > http://people.redhat.com/pjones/rhythmbox-pm.tar.bz2
>
> Peter, shouldn't we just implement the suspend registration interface,
> or just send a signal on suspend or resume? Doing this system wide seems
> the wrong thing to do.

(sorry for the super-late reply :/ )

Yes, an interface to register "please tell me when we're going to
suspend or have resumed" is probably the right thing.  In fact, the dbus
stuff in that tarball is essentially that, with names specific to
rhythmbox.

That solves part of the problem, and it's probably the 90% solution we
should go with, but it doesn't solve the general problem -- which is
basically user-definable, per-session hooks.  I don't think that's
really worth trying very hard at, but if anybody really wants it, it
takes about 40 lines of python if we've got the interface discussed
above.

--
  Peter

_______________________________________________
gnome-power-manager-list mailing list
gnome-power-manager-list@...
http://mail.gnome.org/mailman/listinfo/gnome-power-manager-list

Re: Exec a command before and after suspeding

by Richard Hughes :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tue, 2007-01-02 at 11:18 -0500, Peter Jones wrote:
>
> That solves part of the problem, and it's probably the 90% solution we
> should go with, but it doesn't solve the general problem -- which is
> basically user-definable, per-session hooks.  I don't think that's
> really worth trying very hard at, but if anybody really wants it, it
> takes about 40 lines of python if we've got the interface discussed
> above.

I'm working on this in g-p-m. Hold that thought ;-)

Richard.


_______________________________________________
gnome-power-manager-list mailing list
gnome-power-manager-list@...
http://mail.gnome.org/mailman/listinfo/gnome-power-manager-list
LightInTheBox - Buy quality products at wholesale price