Skip to content

Shutting down SER cleanly from batch file

I've posted this already in an old thread which isn't showing up sorry for duplicating it.

https://forum.gsa-online.de/discussion/comment/62715/#Comment_62715

@sven As @kaene said would it be possible to add a command line parameter to close it? It would detect that it's already running, send a close signal to that instance and the instance would do a clean close.

The "GSA_Search_Engine_Ranker.exe -autostart" is great but I have no way of sending WM_CLOSE and don't like the idea of just killing the running program.

Is there any other way to cleanly shut down the GUI?

I need to restart my PC every 8 hours or so and would like to schedule a job to automatically shut down CB and SER / reboot and then restart CB and SER unattended,

A clean shutdown would be nice.

Thank you

Bob

Comments

  • SvenSven www.GSA-Online.de
    whats holding you back from sending a WM_CLOSE using the application handle? 
  • err what's WM_CLOSE using the application handle. I don't know how to do that :)
  • SvenSven www.GSA-Online.de
    Oh I thoughght as you used WM_CLOSE term you where familar with that and coding in general. Well you can of course list all programs running and there handle. Then use that handle and send it a close command. SER will close down on that.
  • I see I have no idea how to do that so as I understand it there isn't a way of doing it without coding (which I can't do)?
  • SvenSven www.GSA-Online.de
    next version supports "-close" as parameter which will shut down a running SER.
  • @Sven you are a legend :) thank you.
  • After the update if you run "C:\Program Files\GSA Search Engine Ranker\" Search_Engine_Ranker.exe -close
    it does shut the GUI but pops up the windows error "An error has occurred in the application" and it halts waiting for you to choose continue/restart/close.

    Is it possible to prevent this as it stops any further processing (ie backup) - I run Windows XP SP3

    ty though @Sven I appreciate it.
  • SvenSven www.GSA-Online.de
    hmm didn't get that one...should shutdown without that error.
  • I'll video it if you like :)
  • you can find the handle by using like api like Findwindow()
    then send the wm_close message. doesn't it work ? i didn't try.
  • If you like, you can send WM_CLOSE using NirCmd in a batch file.
    closeprocess [process]
    Terminates the specified process, by closing its top level windows. As opposed to killprocess command, closeprocess doesn't force the process to be closed immediately. Instead, it send WM_CLOSE message to all top level windows of the specified process. However, be aware that this command will not work on process with no user interface.

    In the [process] parameter, you can specify the full path of the process filename (e.g: 'C:\Program Files\Internet Explorer\iexplore.exe') or the name of the process only, without the path (e.g.: iexplore.exe). You can also specify the Process ID, by adding the '/' character as a prefix (e.g. /1120). 


    Examples: 
    closeprocess iexplore.exe 
    closeprocess "c:\winnt\system32\calc.exe" 
    closeprocess /1830

  • ty @coneh34d that does indeed close the process. It would still be nice if SER then stopped all running processes / flushed all pending disk requests and closed cleanly so that no data was lost.

    @Sven nearly has it with the -close switch - just needs to stop the windows dialog from popping up :)

    Thank you for taking the time to reply I appreciate it and I didn't know about NirCmd bloody useful little utility.
Sign In or Register to comment.