[VSERVER] stopping the service

Erich Geiersberger erichg at mcmm.com
Sat Nov 20 00:41:21 CST 2004


>Hi Erich,
>
>>  I have lost hours yesterday trying to stop the server from my
>>  Director installer during a server database update.
>>  The docs say it is stopped using -d which actually seems to
>>  deactivate the service but leaves the databases in a state where they
>>  can't be copied.
>>
>>  In the list I found later that the service can be stopped with a -k
>>  option which seems to work but is not documented. Please update the
>>  Vserver documentation.
>
>Ok, thank you.
>
>>  I am also looking for a possibility to do the same on OSX. How can I
>>  stop the service on OSX during an update? I know about the
>>  - open a terminal window
>>  - log in as admin
>>  - look for the service
>>  - kill it
>>  thing, but that's not a smooth way to go through during a
>>  software/database update from within another program.
>>
>>  Is there any other way?
>
>I think solution can be next:
>
>1) we need check if command KILL can kill app not by ID but by name also.
>     if yes, then you must be able kill from terminal
>
>     kill vserver  -6
>         // -6 it is QUITE command (by my memory)
>         // so all dbs will be closed
>
>
>
>2) second step is to automate this for you.
>
>     you know about shell scripts ?
>     you can see example of one in the
>    
>     /Library/StartupItems/VServer
>
>     they have special first line,
>     and rest lines like you type in terminal.
>    
>
>And final step, when you have such shell script, you must have way CALL IT
>from your installer.

Hi Ruslan
Hi list

I have found a solution and want to share it with you.
It can be done with the following apple script:

on run
   set myString to do shell script "/bin/ps -ax"
   set theCount to the number of paragraphs in myString
   set loopCounter to 1
   repeat theCount times
     if paragraph loopCounter of myString contains 
"Library/ValentinaServer" then
       set psNumber to the first word of paragraph loopCounter of myString
       set theCommand to "/bin/kill -9 " & psNumber
       do shell script theCommand with administrator privileges
       return
     end if
     set loopCounter to loopCounter + 1
   end repeat
end run

Of course the path to and name of the server must possibly be changed 
according to your needs.

Erich


More information about the Valentina mailing list