Restarting OS X from the command line



Joshua Schnell | Wed, May 7, 2008 @ 8:00 am

As you can tell, we’ve decided to write a couple articles on using the command line in OS X. There is so much power available at your finger tips if you can get through the learning process of the unix based environment. For instance, you have the ability to restart any machine from the command line both locally or across any network (internet included). This is great if you find that screensharing or VNC connections are running a bit slow.

To Restart the Server locally

  1. Type ‘shutdown -r now’

To Restart the Server remotely with ssh.

  1. ssh -l root server shutdown -r now

The ‘-l ‘ simply tells the server what your login name is, so, in this case it is root. The ‘server ‘ part of the command will be your URL, or IP address of the server. The ‘-r ‘ means you want a reboot. Don’t forget this, because if you do, your machine will be shutdown instead of rebooted. Which means you’d have to leave your desk and turn the thing back on!!! The ‘now ‘ means you want it done this instant.You can also set the time you would like the server to reboot by adding the time to the end of the command in the format ‘hhmm ‘. H for hours, M for minutes.

  1. ssh -l root server shutdown -r now 1130

There ya go. You no longer have to use a VNC (remote desktop) application to reboot a server. Which in my case is a great thing, considering my vnc-server software tends to freeze up a lot.

Want more Apple coverage? We're all over the place. You can follow us on Twitter or become a fan on Facebook. You can also subscribe to our RSS feed

This post was written by:

Joshua Schnell - who has written 1122 articles on Macgasm.

Well, I'm pretty much addicted to all things Apple, and Twitter. That's probably all you really need to know. If I'm not posting here, I'm probably wasting time on Twitter.

Contact the author

6 Responses to “Restarting OS X from the command line”

  1. Ken Says:

    You can also use the “reboot” command, or you might have to do “sudo reboot” to run it as root.

    Reply

  2. macgasm Says:

    that would be the easy way… ;) I tend to do things the difficult way…lol.

    Reply

  3. macgasm Says:

    that would be the easy way… ;) I tend to do things the difficult way…lol.

    Reply

  4. 0b1 Says:

    The
    ssh -l root serverIPAddrHere reboot -q

    will sit there and wait for additional input because the system terminated ungracefully. Enter a semi-colon (type “;” and press return) and it will then indicate that the connection was reset by peer.

    Reply

  5. Sam Says:

    I got the latest Mac Mini server, and I just did the reboot the OS via ssh remotely.

    But got problem, that the server is up (I can ping it), but there is not any service started, because I can’t ssh, http, mail etc.

    So my question is, why the Services do not start after the reboot? should I personally log into the server as Admin before these fundamental services can start?

    any info would be much appreciated.

    Reply


Trackbacks/Pingbacks

  1. [...] public links >> screensharing Restarting OS X from the command line Saved by frankybody on Fri 03-10-2008 Fixing the rare Yugma “client.properties” error on [...]

Leave a Reply