You are not logged in.

#1 2008-10-06 15:26:10

dan653
Member
Registered: 2008-09-29
Posts: 10

disconnect rdesktop session before hibernating - how to?

hi, i've just managed to get suspend-to-ram and suspend-to-disk working on my laptop and have been successful in linking them to different acpi events and laptop-mode-tool thresholds (eg. low battery)

i am big user of rdesktop on my laptop which i use to conect to my main pc in my bedroom.

rdesktop -f -u dan -p <password> 10.0.0.3

my question is how would i go about getting pm-hibernate/suspend to cleanly disconnect from any active rdesktop sessions (normally just the one) before taking down my network connection? (no need to reconnect upon resume)


Fujitsu Siemens Lifebook S7020 - 2.0ghz Centrino | 2gig RAM | 80gig SATA HDD

Offline

#2 2008-10-06 20:42:25

BKJ
Member
Registered: 2008-09-19
Posts: 71

Re: disconnect rdesktop session before hibernating - how to?

Seems a very basic script would do the trick.  Simply create a new file in your home directory eg... pm_suspend, make it executable, and place the following in it.  Then simply run the script.  It's not fancy but will do the trick.

killall rdesktop
sleep 2
sudo pm-suspend

Offline

#3 2008-10-06 21:35:53

dan653
Member
Registered: 2008-09-29
Posts: 10

Re: disconnect rdesktop session before hibernating - how to?

figured it would be something simple like that.

what does the second line do btw?

not too familar with all the essential commands yet having just made the jump from pre-school (ubuntu) straight to big school (arch with openbox). about time i started actually learning instead of just using


Fujitsu Siemens Lifebook S7020 - 2.0ghz Centrino | 2gig RAM | 80gig SATA HDD

Offline

#4 2008-10-06 22:57:28

pointone
Wiki Admin
From: Waterloo, ON
Registered: 2008-02-21
Posts: 379

Re: disconnect rdesktop session before hibernating - how to?

"sleep 2" will simply pause execution for two seconds, allowing "rdesktop" to be fully killed before continuing.

I think the more "correct" way to go about this, by the way, is to create a hook in /etc/pm/sleep.d. See the pm-suspend manpage for details (under the "files" section). This would also allow you to have pm-suspend restart your connection on resume.

...of course, there are those that would argue that the "correct" way is simply any way that works. To each his/her own.

Last edited by pointone (2008-10-06 22:58:53)


M*cr*s*ft: Who needs quality when you have marketing?

Offline

#5 2008-10-07 01:14:29

dan653
Member
Registered: 2008-09-29
Posts: 10

Re: disconnect rdesktop session before hibernating - how to?

cheers, thats something to try tomorrow, i'll get the quick and dirty script working and then see if i can do it with hooks


Fujitsu Siemens Lifebook S7020 - 2.0ghz Centrino | 2gig RAM | 80gig SATA HDD

Offline

#6 2008-10-07 05:29:40

BKJ
Member
Registered: 2008-09-19
Posts: 71

Re: disconnect rdesktop session before hibernating - how to?

Yes, I agree with @pointone suggestion as the more elegant way to do it.  But the files in /etc/pm/sleep.d are simply scripts as well.  smile

Offline

#7 2008-10-07 21:31:50

alienman
Member
From: Mexico
Registered: 2008-07-08
Posts: 106

Re: disconnect rdesktop session before hibernating - how to?

I think that the advtange of using hook scripts is that they are placed where they should be, if you were building each script wherever you want, you would have a lot of scripts everywhere in would be difficult to know what they do.

For me is like they are placed where they should be, and not in a messed way.


ISC - Ignacio Marmolejo
ArchLinux & GNOME User.

Offline

#8 2008-10-07 22:12:24

pointone
Wiki Admin
From: Waterloo, ON
Registered: 2008-02-21
Posts: 379

Re: disconnect rdesktop session before hibernating - how to?

The other benefit is that pm-* calls scripts in /etc/pm/sleep.d with the arguement "sleep/hibernate" on sleep/hibernate and with "resume/thaw" on resume/thaw. This allows you to easily restart/undo whatever you needed to stop/change before suspending.


M*cr*s*ft: Who needs quality when you have marketing?

Offline

#9 2008-10-08 01:05:48

BKJ
Member
Registered: 2008-09-19
Posts: 71

Re: disconnect rdesktop session before hibernating - how to?

@pointone & @allienman I agree with the both of you about the placement of the file(s).  I like good house keeping as well.  smile  But he did say he did not care about his rdesktop connection being resumed.  Anywho, he has his solution.  Arch ON!  smile

Offline

#10 2008-10-08 17:47:25

tigrmesh
IRC Op
From: Florida, US
Registered: 2007-12-11
Posts: 794

Re: disconnect rdesktop session before hibernating - how to?

@dan653
Wonderful that you found the answer.  Please mark this thread as solved (edit your first post).  That way, others with this question can find help easily.  Thanks.

Offline

Board footer

Powered by FluxBB