Run a command on wakeup from suspend? - AVS Forum | Home Theater Discussions And Reviews
Forum Jump: 
 
Thread Tools
post #1 of 11 Old 02-28-2008, 07:41 PM - Thread Starter
Advanced Member
 
stoked's Avatar
 
Join Date: Jul 2004
Posts: 981
Mentioned: 4 Post(s)
Tagged: 0 Thread(s)
Quoted: 0 Post(s)
Liked: 10
Hi all,

I have a service that seems to hang whenever my computer suspends/hibernates and is woken up. I'd like to automatically restart the service when the computer wakes up, does anyone know of a way of doing this? I tried googling, but didn't come up with much.

Thanks.
stoked is offline  
Sponsored Links
Advertisement
 
post #2 of 11 Old 02-29-2008, 08:19 AM
Advanced Member
 
lstepnio's Avatar
 
Join Date: Jan 2003
Location: Tampa, Florida USA
Posts: 592
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 0 Post(s)
Liked: 10
I have resume from suspend events defined in Girder. This might be overkill but you might want to look into Girder as an overall solution. I think there are some Girder-like application that are free that might have such functionality.
lstepnio is offline  
post #3 of 11 Old 02-29-2008, 10:05 AM
AVS Forum Special Member
 
Rupert's Avatar
 
Join Date: Jan 2003
Location: Detroit, MI
Posts: 2,168
Mentioned: 1 Post(s)
Tagged: 0 Thread(s)
Quoted: 1 Post(s)
Liked: 12
Quote:
Originally Posted by stoked View Post

Hi all,

I have a service that seems to hang whenever my computer suspends/hibernates and is woken up. I'd like to automatically restart the service when the computer wakes up, does anyone know of a way of doing this? I tried googling, but didn't come up with much.

Thanks.

You can assign a task, such as "net start service", to events generated in the Windows Event Log.


In Windows XP, you can use the Eventtriggers tool.

In Vista, assigning tasks to events is built in to the Event Viewer:

http://www.microsoft.com/technet/Win....mspx?mfr=true
Rupert is offline  
Sponsored Links
Advertisement
 
post #4 of 11 Old 02-29-2008, 10:51 AM - Thread Starter
Advanced Member
 
stoked's Avatar
 
Join Date: Jul 2004
Posts: 981
Mentioned: 4 Post(s)
Tagged: 0 Thread(s)
Quoted: 0 Post(s)
Liked: 10
Quote:
Originally Posted by Rupert View Post

You can assign a task, such as "net start service", to events generated in the Windows Event Log.


In Windows XP, you can use the Eventtriggers tool.

In Vista, assigning tasks to events is built in to the Event Viewer:

http://www.microsoft.com/technet/Win....mspx?mfr=true

Awesome... exactly what I was looking for... thanks Rupert! Doesn't seem to be a "net restart Service" option... will have to see if I can get this to work.
stoked is offline  
post #5 of 11 Old 02-29-2008, 10:56 AM
AVS Forum Special Member
 
Rupert's Avatar
 
Join Date: Jan 2003
Location: Detroit, MI
Posts: 2,168
Mentioned: 1 Post(s)
Tagged: 0 Thread(s)
Quoted: 1 Post(s)
Liked: 12
Quote:
Originally Posted by stoked View Post

Doesn't seem to be a "net restart Service" option...

You would have the task run a batch file. Create a batch file using the command:

net start NameOfService


Type "net start" (without the quotes) at a command prompt for more info.
Rupert is offline  
post #6 of 11 Old 02-29-2008, 11:42 AM - Thread Starter
Advanced Member
 
stoked's Avatar
 
Join Date: Jul 2004
Posts: 981
Mentioned: 4 Post(s)
Tagged: 0 Thread(s)
Quoted: 0 Post(s)
Liked: 10
Quote:
Originally Posted by Rupert View Post

You would have the task run a batch file. Create a batch file using the command:

net start NameOfService


Type "net start" (without the quotes) at a command prompt for more info.

Thanks, yeah I just started going through the details. Already have a batch file.
stoked is offline  
post #7 of 11 Old 02-29-2008, 12:50 PM
Advanced Member
 
ctiq21's Avatar
 
Join Date: Apr 2004
Posts: 941
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 25 Post(s)
Liked: 23
If you go into the properties of the service, under the recovery tab you can have it restart automatically if it happens to stop. no need to create a batch file or anything.
ctiq21 is offline  
post #8 of 11 Old 02-29-2008, 04:02 PM - Thread Starter
Advanced Member
 
stoked's Avatar
 
Join Date: Jul 2004
Posts: 981
Mentioned: 4 Post(s)
Tagged: 0 Thread(s)
Quoted: 0 Post(s)
Liked: 10
Can't seem to get this to work. I always get a ERROR: Unable to create event trigger named "Trigger Name". Tried this on XP MCE and 2 XP Pro machines. I even copy and pasted some of the examples from eventtriggers /create /? and no luck.

UPDATE: Got it working... think it must be either order of the command switches or case sensitivity...
stoked is offline  
post #9 of 11 Old 03-02-2008, 05:35 PM - Thread Starter
Advanced Member
 
stoked's Avatar
 
Join Date: Jul 2004
Posts: 981
Mentioned: 4 Post(s)
Tagged: 0 Thread(s)
Quoted: 0 Post(s)
Liked: 10
Rupert,

Was able to create the eventtrigger, but it doesn't seem to trigger on the Event Log entry... have you been successful using this?
stoked is offline  
post #10 of 11 Old 03-03-2008, 12:51 AM
AVS Forum Special Member
 
Rupert's Avatar
 
Join Date: Jan 2003
Location: Detroit, MI
Posts: 2,168
Mentioned: 1 Post(s)
Tagged: 0 Thread(s)
Quoted: 1 Post(s)
Liked: 12
Quote:
Originally Posted by stoked View Post

Rupert,

Was able to create the eventtrigger, but it doesn't seem to trigger on the Event Log entry... have you been successful using this?

Yes, it works on an XP Pro machine I use. It triggers when the NIC announces that it's up (Event ID 11). Here's the command line:

eventtriggers /create /tr "MyTriggerName" /eid 11 /t INFORMATION /tk c:\\windows\ est1.bat /ru MyUsername /rp MyPassword

The batch file is just this:

net start MyServiceName


Send me a PM if you have trouble with it.
Rupert is offline  
post #11 of 11 Old 03-03-2008, 01:22 AM - Thread Starter
Advanced Member
 
stoked's Avatar
 
Join Date: Jul 2004
Posts: 981
Mentioned: 4 Post(s)
Tagged: 0 Thread(s)
Quoted: 0 Post(s)
Liked: 10
Quote:
Originally Posted by Rupert View Post

Yes, it works on an XP Pro machine I use. It triggers when the NIC announces that it's up (Event ID 11). Here's the command line:

eventtriggers /create /tr "MyTriggerName" /eid 11 /t INFORMATION /tk c:\\windows\ est1.bat /ru MyUsername /rp MyPassword

The batch file is just this:

net start MyServiceName


Send me a PM if you have trouble with it.


Didn't get a chance to update my above post, but I got it working. Turns out eventtriggers run under the System user... which didn't have access to where my batch file was located. Moved it to C:\\windows\\system32 and it works now. Thanks!
stoked is offline  
Sponsored Links
Advertisement
 
Reply Home Theater Computers

Thread Tools
Show Printable Version Show Printable Version
Email this Page Email this Page


Forum Jump: 

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 On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off