0

I want to be able to switch on a computer using Linux Bash. Is there a way?

I know to switch off by use of such command as $(init 0) within a bash script

$(init 0)

Victor Langat
  • 51
  • 1
  • 7
  • Which computer is going to run this command? Can't be the one that's off, if it's really off. A remote system wouldn't be able to connect either, because it's...well, off. Do you mean sleeping? Is it a VM you could control by talking to the cluster? – Paul Hodges Apr 24 '19 at 15:18

2 Answers2

1

You can use a wake-on-lan tool, passing the MAC address of the machine to start as an argument.

See: Bash one-line command to send wake on LAN magic packet without specific tool

MisterSmith
  • 2,884
  • 1
  • 10
  • 13
0

Its doable in Mac (below), but a bit tricky on Linux. Best bet is to enter into the BIOS by hitting "F2" after you have switched your machine on and find the "Auto Power On" command ... but no scripting.

In Mac OS X bash its part of the "sudo systemsetup" command and could be achieved via "-setharddisksleep minutes" and you can even schedule it via crontab -e, but only as root user. To be honest in Mac its easier to just go to "Energy Saver" and set "Schedule" ... but no scripting.

M__
  • 614
  • 2
  • 10
  • 25