Discussion Locked

Remote shutdown in linux

0 helpful
6 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
hello

6 replies

by x-marcap

This is brute force, but pretty solid.

Edit the .rhosts file in root's home directory. Put in your control machine's name.

rsh to every machine that on the list and create this simple script on each box in /usr/local/bin and call it nightly_turnoff.sh.

#!/bin/sh
cd /
shutdown -i0 -g0 -y

in your master script

#!/bin/sh
rsh boy0 /usr/local/bin/nightly_turnoff.sh

Just replace boy0 with the name for your systems and duplicate it with many lines.

The last line on your script is to run the script on your own machine...

by x-marcap

This just takes a few minutes of setup.

1. You should be root on a linux box.
2. put the .rhosts in every ~root that needs shutdown.

the cron entry should look like this:

00 22 * * * /usr/local/bin/nightly_turnoff

by jmgarvin

Let's address the cause and not just us a band-aid.

1) Why are they crashing? Have you looked at the logs?
2) Why is the performance going down? top will let you see what is running and ps aux (as root) will let you see all running processes.
3) Free disk space and swap space can be the cause
4) Hardware, heat, and other causes have been investigated?
5) If you are running older Dell systems with RAID controllers, update the RAID driver.

As for rebooting remotely, why bother, just setup a cron job that reboots your machines everyday at 11:55pm.

crontab -e
55 23 * * * reboot

There you go...

by jmgarvin

Just setup the cron job like I and the others have suggested.

You just push the script to the machines and be done with it.

This discussion is closed to new replies.