My UNIX machine is placed geographically in another location. I have a remote access towards it. I want to abruptly switch off my unix machine through remote connection. Is it possible through any UNIX commands? I practically want to power off a PC , something like unplugging a power cable of a machine which doesnt has a UPS connected to it. Is it possible via any software or statements?
If the PSU can be turned of from the system that should do it.
But remember if it's a PC based system you may have to have someone go and push the button.
If the machine has a Service Controller or a HACMP or ILOM or ALOM, there will be a specific sequence to power it off - accessed through one of these devices.
One of the side results of some in-depth HACMP-tests we (some colleagues of mine and me) carried out 15 years ago was a collection of more or less ingenious ways to stop a system as fast as possible. Since then i have tested now and then these methods - more out of curiosity than for any practical purpose. These are the methods we found, listed in order from slow and safe to fast and dangerous:
shutdown -h now
shutdown -fh now
Some systems use "-F" instead of "-f". Is supposed to skip some safety measures and therefore to be faster.
sync ; sync ; halt
will be even faster but might (only in extreme cases) damage the system because it stops without anything being closed in order. Still, most systems will survive this and boot more or less properly after being killed that way.
halt -q
Even faster, but don't try this without a journaling file system (don't try this at all without the need to do so). Old SunOS versions, for instance, had a fair chance of not coming up properly again after such a nosedive. Even with a journaling FS there is some risk, which is why it should only be used as either a very extreme measure or for testing purposes on expendable (test) systems. The same goes for the "winner":
cat /etc/hosts > /dev/kmem
Any other file will do too - i use this just out of habit. On POWER and PC hardware (and probably on most other hardware too) this was consistently faster than even "halt -q", it takes only about a dozen bytes to be written over the kernel image to crash the system. In AIX this is not possible any more, because even root cannot write to /dev/kmem in newer versions.
This is a foolish action which is quite likely to damage your data and can result in a system which never works again.
Btw. CentOS is Linux variant. It is not unix.
However if this is a proper server with a management card it should be possible to control the power switch with remote management software (however stupid this action may be). If it is just a PC, not a hope short of using Internet-controlled power switches (which are available).