trying to make a shutdown script on red hat if even possible.
ok, i want to try to make my first script while also making something useful.
My goal: To make the system shut down at 12 am every night. When I get that down, then I want to make it so it shuts down at a certain time on week days (ie: 10 pm) then make it shut down 12am on weekends. Next, to make it so if the computer is in use, to not shut down. Is it possible to do that?
I know to shut down the system you have to be logged as root. And i want it to start up the script everyday(which im not sure how to do yet..)
I am not really sure how to do it, but am trying to figure it out from some websites and a linux book.
heres what i think i have to do:
su -(to log in as root, then have it skip the password or something)
shutdown -h now ( to shut it down, not sure how to time it though)
Thats about as far as i have gotten...any ideas?
September 27, 2003 03:15 PM
Well, if you want to run something at a certain time every day you can use this unix program called cron. I don''t have much experience with it but here is a link that might be of some help: http://www.unixgeeks.org/security/newbie/unix/cron-1.html.
Good luck!
Good luck!
Check the number of people logged in, using ''who'' and counting lines of output, or something. then shut down.
OR, check the current system load, too. depending on whether you ment "in use" as "someone logged in doing something" or "some service chewing away at something"
thats what you put in the script, then just set up cron to run that script at the right times on the rights days.
OR, check the current system load, too. depending on whether you ment "in use" as "someone logged in doing something" or "some service chewing away at something"
thats what you put in the script, then just set up cron to run that script at the right times on the rights days.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement