6

I am searching for a POSIX command to shutdown a machine.

Is there a POSIX acceptable way to do this?

The commands I use to do this are not POSIX compatible (e.g., shutdown, reboot, halt or poweroff).

Systemd introduced systemctl to do this, but I am pretty sure that this is not POSIX, either.

9

No, POSIX does not care about the shutting down or rebooting of a Unix system, nor about how services are started at boot.

The following areas are outside of the scope of POSIX.1-2017:

  • Graphics interfaces

  • Database management system interfaces

  • Record I/O considerations

  • Object or binary code portability

  • System configuration and resource availability

POSIX.1-2017 describes the external characteristics and facilities that are of importance to application developers, rather than the internal construction techniques employed to achieve these capabilities. Special emphasis is placed on those functions and facilities that are needed in a wide variety of commercial applications.

(from the Introduction section of the POSIX Base Definitions)

The shutdown command would fall into the "System configuration and resource availability" category, and it's not a tool that is important to application developers.


The full POSIX standard is available online.

  • 1
    Probably because developers do never sleep, but there is 'vi' on the list, important for developers writing code or maybe for doing text processing? That is a very strange way to think. Because some scripts maybe need to reboot or shutdown in a standard way, I am exacltly having this issue writing code for a appliance menu that runs under linux and needs to shutdown. (Shell Script) – Luciano Andress Martini Mar 20 at 12:59
  • I am considering to use init, as it is the only listed in Unix Seventh Edition manpage and it is working both in systemd and sysvinit systems, so I think it will run in most of unix based system . – Luciano Andress Martini Mar 25 at 18:31
  • @LucianoAndressMartini You tried it on a non-Linux system? – Kusalananda Mar 25 at 18:34
  • Thank you. Yes I tried in FreeBSD, and it powered off at end too (init 0). It look like that it will work, as it is in manpages of the first BSDs also. I cant test in MacOS, a Apple here in Brazil are very expensive. shutdown or halt are not listed in Unix Seventh Edition manpage. init seems to be the only way to shutdown it, so I think if in the start was like that, it must be for a while more (if they still have some respect, that is really a beautiful and simple manpage), And SunOS seems to have this as the more recommended way in documentation. – Luciano Andress Martini Apr 23 at 20:57
2

A review of the list of all POSIX commands beginning on page 4, shows no equivalent to halt or shutdown.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.