LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 08-16-2005, 01:28 PM   #1
dasbooter
Member
 
Registered: Mar 2005
Posts: 122

Rep: Reputation: 15
ssh to place windows box into standby?


MY ultimate goal is to have xscreensaver on a Suse linux install on box1 one tell a windows installation on box2 to go into standby.

So far I have been able to get ssh up and running with passwordless logons on both boxes.

I can run this code after sshing to the windows box from the linux box
Code:
CMD /c C:\standby.bat
in a shell script to call a batch script with this code
Code:
 %windir%\system32\rundll32.exe PowrProf.dll, SetSuspendState
which successfully places the windows computer into standby.

Both scripts reside on the windows system.

what would be the code to do all of this automatically and call the shell script from the linux box. I will work on getting it working with xscreensaver later?

to reiterate I want a script on the linux box that will logon to the windows
box and put it into standby.

Cygwin is installed with default packages and ssh.

Thanks in advance for all your help.
 
Old 08-17-2005, 12:53 PM   #2
Harry Seldon
Member
 
Registered: Feb 2004
Distribution: SLES 9
Posts: 112

Rep: Reputation: 15
Run a script in your crontab that searches current processes for your screensaver app. If the screensaver app is running, execute the windows script using ssh. You can parse out your processes using awk.
 
Old 08-18-2005, 06:27 PM   #3
dasbooter
Member
 
Registered: Mar 2005
Posts: 122

Original Poster
Rep: Reputation: 15
well I can use xscreensaver-command-watch which: (from http://www.jwz.org/xscreensaver/man3.html )

Prints a line each time the screensaver changes state: when the screen blanks, locks, unblanks, or when the running hack is changed. This option never returns; it is intended for use by shell scripts that want to react to the screensaver in some way. An example of its output would be:

BLANK Fri Nov 5 01:57:22 1999
RUN 34
RUN 79
RUN 16
LOCK Fri Nov 5 01:57:22 1999
RUN 76
RUN 12
UNBLANK Fri Nov 5 02:05:59 1999

The above shows the screensaver activating, running three different hacks, then locking (perhaps because the lock-timeout went off) then unblanking (because the user became active, and typed the correct password.) The hack numbers are their index in the `programs' list (starting with 1, not 0, as for the -select command.)

For example, suppose you want to run a program that turns down the volume on your machine when the screen blanks, and turns it back up when the screen un-blanks. You could do that by running a Perl program like the following in the background. The following program tracks the output of the -watch command and reacts accordingly:


#!/usr/bin/perl

my $blanked = 0;
open (IN, "xscreensaver-command -watch |");
while (<IN>) {
if (m/^(BLANK|LOCK)/) {
if (!$blanked) {
system "sound-off";
$blanked = 1;
}
} elsif (m/^UNBLANK/) {
system "sound-on";
$blanked = 0;
}
}

Note that LOCK might come either with or without a preceding BLANK (depending on whether the lock-timeout is non-zero), so the above program keeps track of both of them.


What I dont understand is what should be in the script in order to ssh to the windows box and run the script located there to put the windows box into standby?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Understanding SSH (Sun box to Linux box) oswald21 Linux - Newbie 2 07-08-2006 02:06 PM
Advise on whether to place Subversion (+ ssh) in the DMZ or LAN? almo Linux - Security 3 08-07-2005 03:26 PM
Linux box calling a batch script on a windows box to run? Is it possible? joelhop Programming 8 05-17-2004 04:49 PM
Apache, SSh, Webmin, stops when laptop standby carlosruiz Linux - Laptop and Netbook 1 03-13-2004 06:33 AM
Can you SSH to a Windows Box? Thaidog Linux - Newbie 5 10-01-2002 08:27 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 02:09 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration