Re: Saving sessions before a system shutdown

José Alburquerque <[email protected]>
Newsgroups gmane.comp.gnome.devel
Message-ID <[email protected]>
Ted Gould wrote:
> On Mon, 2007-11-26 at 20:21 -0500, José Alburquerque wrote:
>   
>> Ted Gould wrote:
>>     
>>> I don't know if you've already gotten an answer, but I don't think there
>>> is a generic way to do this currently.  But, I think the part you're
>>> looking for is probably the command: "gnome-session-save".  I believe if
>>> you run this with "--kill" and "--silent" on all users currently logged
>>> in you should get what you're looking for.
>>>       
>> Thanks for answering.  A developer from this list did give a similar 
>> answer off-list, but, again, I appreciate your suggestion.  :-)
>>     
>
> For those finding this thread on Google, did it work?  Any advice from
> your experiences?
>
> 		--Ted
>
>   
I haven't gotten around to implement the solution I'm thinking about.  
As I mentioned the other developer suggested that I use 
gnome-session-save (as you suggest).  With his permission (please), our 
conversation on this is below:

------- Original Message --------
Subject: 	Re: Saving sessions before a system shutdown
Date: 	Wed, 24 Oct 2007 19:35:39 -0400
From: 	José Alburquerque <[email protected]>
To: 	Kamil Leduchowski <[email protected]>
References: 	<[email protected]> 
<1193267148.6726.10.camel@softmachine>



Kamil Leduchowski wrote:
> Dnia 24-10-2007, Śr o godzinie 16:08 -0400, José Alburquerque pisze:
>
>   
>> Does anyone think it's possible to insert some script in /etc/init.d
>> that might save the session before a shutdown?  In other words is there
>> some way to save the session(s) (if there are more than one) just before
>> a shutdown?
>>     
>
> Try adding gnome-session-save --silent to your logout script/cron
> command this should do the trick for you. Btw gnome-devel-list is for
> developer issues. In future I recommend using [email protected]
>
>   
I understand this is a developer's list, I just thought that I could 
find a bit of wisdom here; also I don't get answers in gnome-list!

BTW, your solution assumes that the script runs from within the gnome 
session.  For example, if I have a gnome session running and login in a 
virtual console as the same user and use the gnome-session-save command 
above, it fails because it "cannot open display".

I know about the "gnome-session-save" command, but what I'm sort of 
looking for is an idea as to how a root script (not a script within the 
session) can "safely" save the sessions of users logged in just before 
shutting down.  I was sort of looking for pointers from smart people 
about what paths I might follow to attempt to "tackle" this 
"theoretical" problem.  I hope I didn't bother any of the developers or 
you.  Any ideas on this?  Thanks.

-Jose

-------- Original Message --------
Subject: 	Re: Saving sessions before a system shutdown
Date: 	Wed, 31 Oct 2007 15:00:14 -0400
From: 	José Alburquerque <[email protected]>
To: 	Kamil Leduchowski <[email protected]>
References: 	<[email protected]> 
<1193267148.6726.10.camel@softmachine> <[email protected]> 
<1193828970.6709.12.camel@softmachine>



Kamil Leduchowski wrote:
> Dnia 24-10-2007, Śr o godzinie 19:35 -0400, José Alburquerque pisze: 
>   
>> Kamil Leduchowski wrote:
>>     
>>> Dnia 24-10-2007, Śr o godzinie 16:08 -0400, José Alburquerque pisze:
>>>       
>> BTW, your solution assumes that the script runs from within the gnome 
>> session.  For example, if I have a gnome session running and login in a 
>> virtual console as the same user and use the gnome-session-save command 
>> above, it fails because it "cannot open display".
>>
>>     
>
> Hello. Yes you are right it is a bit more complicated. "cannont open
> display" can be avoided by adding a --display option to save session
> command, in example:
>
> gnome-session-save --silent --kill --display=:0
>
> (if you use only one display that is) but this alone ain't enough.
> There's one more thing you need and that's a functional SESSION_MANAGER
> value created when X starts (for example it might look like
> local/softmachine:/tmp/.ICE-unix/5845) and it points to a socket on your
> local machine, but it isn't stored anywhere outside X session. In order
> to make gnome-session-save working outside you need to export it first
> on non-X terminal:
>
> export SESSION_MANAGER=local/softmachine:/tmp/.ICE-unix/5845
>
> and then call the session save command (the one listed above will save
> and end your gnome session without asking for a confirm on X). I hope
> this will help a bit.
>   
Thanks a lot.  It does help.  I'm thinking that maybe I can insert some 
commands somewhere when the session starts to store these values 
somewhere (on a per-user basis).  I can then use the values in a 
"general" script to save all the running sessions.  Last question if you 
can answer (and thanks for your reply!):  Would you have an idea as to 
where in the session start process I might be able to "export" these 
values on a per-user basis?  If I can figure this out, I'm sure I'll be 
able to write a general session saving script.  Again, thanks for 
pointers they've been really helpful.

-Jose


-------- Original Message --------
Subject: 	Re: Saving sessions before a system shutdown
Date: 	Mon, 05 Nov 2007 18:57:57 -0500
From: 	José Alburquerque <[email protected]>
To: 	Kamil Leduchowski <[email protected]>
References: 	<[email protected]> 
<1193267148.6726.10.camel@softmachine> <[email protected]> 
<1193828970.6709.12.camel@softmachine> <[email protected]>



José Alburquerque wrote:
> Thanks a lot.  It does help.  I'm thinking that maybe I can insert 
> some commands somewhere when the session starts to store these values 
> somewhere (on a per-user basis).  I can then use the values in a 
> "general" script to save all the running sessions.  Last question if 
> you can answer (and thanks for your reply!):  Would you have an idea 
> as to where in the session start process I might be able to "export" 
> these values on a per-user basis?  If I can figure this out, I'm sure 
> I'll be able to write a general session saving script.  Again, thanks 
> for pointers they've been really helpful.
>
> -Jose
>

Don't bother, I figured this out thanks to your previous pointers.  Thanks.

-Jose

-----------------------------------------------------------------------------


Based on the above e-mails, I thought that using an x (or gnome-session) 
startup script of some sort, I could save session information for a user 
when he/she logs in.  The script run just before shutdown could use this 
information to save the sessions for the user that wants this.  Also I 
found the following link useful:

http://gnome-hacks.org/hacks.html?id=34

HTH.

-Jose
_______________________________________________
gnome-devel-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/gnome-devel-list
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.