Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fork() should use cmd.Run() rather than cmd.Start() #51

Open
EricHouang opened this issue Mar 13, 2020 · 1 comment
Open

fork() should use cmd.Run() rather than cmd.Start() #51

EricHouang opened this issue Mar 13, 2020 · 1 comment

Comments

@EricHouang
Copy link

func (c *Cmd) Run() error {
if err := c.Start(); err != nil {
return err
}
return c.Wait() // if execute the command fails,return error
}
I use endless in my project. In a production environment, we need to modify the configuration file frequently, and then restart the program for the new configuration to take effect.
But the configuration file often has syntax errors, making the program unable to restart successfully. We need to modify the configuration again and restart again, but endless output "Fork err: Another process already forked. Ignoring this one."

@SURA907
Copy link

SURA907 commented Jul 3, 2020

In my scenario, I use'./app -s restart' to restart server, when app get the arg of '-s restart', it's will do

  1. check config file(include format)
  2. get PIDFile in cofig file
  3. When the process pointed to by pid is running, send SIGHUP to it
  • so I think u should check config file before send restart signal
  • about fork() use the cmd.Start(), I use it to run a deamon process, so the cmd.Run() con't return, until daemon process exit

This is just my suggestion, I hope it will be useful to you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants