Skip to content
This repository has been archived by the owner on Feb 8, 2021. It is now read-only.

Commit

Permalink
deprecate the flag --nondaemon
Browse files Browse the repository at this point in the history
The new bahavior is the same as the --nondaemon is always set.

If the user want to launch hyperd as system daemon,
the user should use the system daemon tools such as systemd.

Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
  • Loading branch information
laijs committed Aug 11, 2016
1 parent b417cc0 commit 1048965
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 22 deletions.
3 changes: 1 addition & 2 deletions hack/test-cmd.sh
Expand Up @@ -48,8 +48,7 @@ function start_hyperd()
sudo "${HYPER_OUTPUT_HOSTBIN}/hyperd" \
--host="tcp://127.0.0.1:${API_PORT}" \
--v=3 \
--config="${config}" \
--nondaemon 1>&2 &
--config="${config}" 1>&2 &
HYPERD_PID=$!

if [ "$sdriver" == "devicemapper" ]; then
Expand Down
21 changes: 3 additions & 18 deletions hyperd.go
Expand Up @@ -22,8 +22,6 @@ import (
"github.com/hyperhq/runv/hypervisor"

"github.com/docker/docker/pkg/parsers/kernel"
runvutils "github.com/hyperhq/runv/lib/utils"
"github.com/kardianos/osext"
)

type Options struct {
Expand All @@ -50,7 +48,7 @@ func main() {
return
}

fnd := flag.Bool("nondaemon", false, "Not daemonize")
fnd := flag.Bool("nondaemon", false, "[deprecated flag]") // TODO: remove it when 0.8 is released
flDisableIptables := flag.Bool("noniptables", false, "Don't enable iptables rules")
flConfig := flag.String("config", "", "Config file for hyperd")
flHost := flag.String("host", "", "Host for hyperd")
Expand All @@ -67,20 +65,8 @@ func main() {
return
}

if !*fnd {
path, err := osext.Executable()
if err != nil {
fmt.Printf("cannot find self executable path for %s: %v\n", os.Args[0], err)
os.Exit(-1)
}

_, err = runvutils.ExecInDaemon(path, append([]string{os.Args[0], "--nondaemon"}, os.Args[1:]...))
if err != nil {
fmt.Println("failed to daemonize hyperd")
os.Exit(-1)
}

return
if *fnd {
fmt.Printf("flag --nondaemon is deprecated\n")
}

var opt = &Options{
Expand All @@ -99,7 +85,6 @@ func printHelp() {
%s [OPTIONS]
Application Options:
--nondaemon Not daemonize
--config="" Configuration for %s
--v=0 Log level for V logs
--log_dir Log directory
Expand Down
Expand Up @@ -10,7 +10,6 @@
<string>--config=/opt/hyper/etc/hyper/config</string>
<string>--log_dir=/var/log/hyper/</string>
<string>-v=1</string>
<string>--nondaemon</string>
</array>
<key>EnvironmentVariables</key>
<dict>
Expand Down
2 changes: 1 addition & 1 deletion package/dist/lib/systemd/system/hyperd.service
Expand Up @@ -5,7 +5,7 @@ After=network.target
Requires=

[Service]
ExecStart=/usr/bin/hyperd --nondaemon --log_dir=/var/log/hyper
ExecStart=/usr/bin/hyperd --log_dir=/var/log/hyper
MountFlags=shared
LimitNOFILE=1048576
LimitNPROC=1048576
Expand Down

0 comments on commit 1048965

Please sign in to comment.