Knowledge Base:Shutdown after emerge

Emerge is not running
This command shuts down the computer only if emerge finishes successfully, it also saves output to a file in the current directory that you can reviewed next time the computer boots. For example for updating and shutting down we have:

If you want to turn off the computer only if emerge quits successfully:

KDE
If you are using KDE, it may be a good idea to have KDE logout first before the shutdown process begins. To do this, type:

Emerge is already running
If emerge is already running, press -. The process will be paused

[1]+ Stopped                 emerge kdebase-meta

Now type

resumes executing of emerge in the background. wait waits for last command sent to background to terminate. When emerge finishes with success, poweroff command will be executed.

Alternatives
This can be accomplish in a similar way by pausing the process with - as described above and then typing this:

or

This continues the paused process and after this process finishes it continues the next command (poweroff) ...

It is important to notice that && will only continue with the next command, if the first command completed successfully. && is the logical AND operator of the shell. By using ; the next command will be executed no matter what happened earlier. ; is only a command separator.

A variant of this can be used to play a sound when emerge is done.

The variant is a little more straight forward probably.

External resources

 * Gentoo Forum
 * Archive from a nonofficial Gentoo wiki