github.com/mvdan/u-root-coreutils@v0.0.0-20230122170626-c2eef2898555/cmds/core/poweroff/poweroff_linux.go (about)

     1  // Copyright 2022 the u-root Authors. All rights reserved
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  // poweroff turns the system off, without delay. There are no options.
     6  //
     7  // Synopsis:
     8  //
     9  //	poweroff
    10  //
    11  // Description:
    12  //
    13  //	poweroff calls the kernel to power off the systems.
    14  package main
    15  
    16  import (
    17  	"log"
    18  
    19  	"golang.org/x/sys/unix"
    20  )
    21  
    22  func main() {
    23  	if err := unix.Reboot(unix.LINUX_REBOOT_CMD_POWER_OFF); err != nil {
    24  		log.Fatal(err)
    25  	}
    26  }