OpenVZ Forum


Home » General » Support » "vzctl stop" is taking too much time when called from a setuid binary
Re: "vzctl stop" is taking too much time when called from a setuid binary [message #3359 is a reply to message #3352] Wed, 24 May 2006 08:56 Go to previous messageGo to previous message
Vasily Tarasov is currently offline  Vasily Tarasov
Messages: 1345
Registered: January 2006
Senior Member
When vzctl stops VPS it does something like that:
1) forks process. This child process enters VPS
2.1) Child process executes "halt" command inside VPS
2.2) parent process waits for VPS dead. <---------- HERE IS YOUR ~5 MINUTS
3) If VPS isn't stopped for some time parent process stops it more roughly: kills init inside VPS.

The question is why child process doesn't execute "halt"? Rolling Eyes
The reason is that vzctl uses getenv("PATH") standard function,
that returns environment variable PATH. It's nessecary to determine the location of halt command. Unfortunately getenv() returns variable from your user environment - not root environment. And there is no /sbin in PATH, where halt usually resides...

So you can add /sbin in PATH (or where is halt in your vps?).
I rewrote a little your programm - it works quckly now. It's in attachment.

HTH!
  • Attachment: vzstop.c
    (Size: 0.97KB, Downloaded 293 times)
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Cpanel Requeriements!!!!
Next Topic: Few questions, please help
Goto Forum:
  


Current Time: Fri Sep 13 15:10:26 GMT 2024

Total time taken to generate the page: 0.05062 seconds