Red HatThis forum is for the discussion of Red Hat Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
i have 5 CentOS servers and my employer is going green and wants all PC's including the servers turned off at night. I want to know is there a way i can issue a command on one server or a windows PC on the Broadcast address or something to turn my serves off.
Or you can do a cron job that runs a simple script every interval. The script is empty initially. But when you want it to shutdown, you have to somehow edit it to run the shutdown command. So at the next schedule, the script will shutdown the system. The interesting part is WHERE the script will be. It can be local or in a shared drive.
So long as you can agree a definite time, cron on the linux systems is simplest.
Add it to the root's cron and do use the full pathname. cron confuses a lot of people by having extremely minimal envronment/path settings.
slacksite: generally, remote login as root is discouraged these day, due to the large num of scripts attempting to break in from the net.
I believe more recent version of eg RH/Centos (and others) turn it off in the relevant ssh server config file for a default install.
However, you could use a script like that to login to user that has been given privs via sudo to do the job.
You could automate it using 'expect' or use ssh auth keys, so no passwd is reqd.
So long as you can agree a definite time, cron on the linux systems is simplest.
Add it to the root's cron and do use the full pathname. cron confuses a lot of people by having extremely minimal envronment/path settings.
chris: hi, I'm pretty new to this forum but was following this thread while looking for some good advise on shutdown using crontab. I edit the crontab table with this:
0 23 * * * /sbin/shutdown -h now
But somehow it does not seems to work. I have the root access to the centos 5.0 server. Any suggestion, please? Thanks.
It's the root crontab. Anyway, I finally got it to work, somehow when you edit your crontab to test, you cannot timed it like a few minute later. I have set crontab for the last couple of evening and it seems to ok now. Thanks!
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.