Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Mar 19, 2005, 02:44 PM   #1
grapes911
Demi-God (Moderator emeritus)
 
grapes911's Avatar
 
Join Date: Jul 2003
Location: Citizens Bank Park
Shutdown computer program or script

I have a lab full of Macs running 10.3.8. I need to shut them all down at night. Every night has a different time. I have users on these machines that just don't leave at closing.

Solution:
I will have a script that is basically "shutdown -h now", and run it from the cron tab. I also need some type of popup reminding people of closing at 20mins, 10mins, 5mins, and 1min.

Problems:
1. People may reboot the computer. I could shutdown the computer every minute for the next 10 minutes or so, until users get the idea. This is dirty, but it will work.

2. I use anacron. If the computer is already off, will the computer shutdown when it comes back off? Can anacron take over some cron scripts and not others?

3. In rare instances, I may need to stop the shutdown. Not all the lab monitors are terminal savvy, so I need an easy way to turn it off. I was thinking of writing a basic program that cron could run. One the last popup window there could be a password field to override shutdown, but I figured this could be forced quit pretty easily.

Anyone have an input or ideas?
grapes911 is offline   0 Reply With Quote
Old Mar 19, 2005, 03:12 PM   #2
Mechcozmo
macrumors 603
 
Mechcozmo's Avatar
 
Join Date: Jul 2004
I guess you've thought of the Schedule feature in Panther under Energy Saver? It will prompt the user to save all files, then shut down the computer. I guess there is the issue of people restarting the computer, but setting up a cron script to run 5 minutes after the computer is supposed to have shut down to shut it down again might work.

If you have a server, can you kick users off? Never used OS X server.... just thinking here...
__________________
This is not the signature you're looking for.
This is not the signature we're looking for.
You can scroll down now.
You can scroll down now.
Mechcozmo is offline   0 Reply With Quote
Old Mar 19, 2005, 04:25 PM   #3
grapes911
Thread Starter
Demi-God (Moderator emeritus)
 
grapes911's Avatar
 
Join Date: Jul 2003
Location: Citizens Bank Park
Quote:
Originally Posted by Mechcozmo
I guess you've thought of the Schedule feature in Panther under Energy Saver? It will prompt the user to save all files, then shut down the computer. I guess there is the issue of people restarting the computer, but setting up a cron script to run 5 minutes after the computer is supposed to have shut down to shut it down again might work.

If you have a server, can you kick users off? Never used OS X server.... just thinking here...
I have thought about the Energy Saver Scheduler. It doesn't have enough controll. I need different times for each day. Plus, its too easy to turn off.

I have a storage server, but they can run most things locally.
grapes911 is offline   0 Reply With Quote
Old Mar 19, 2005, 05:28 PM   #4
Mechcozmo
macrumors 603
 
Mechcozmo's Avatar
 
Join Date: Jul 2004
Quote:
Originally Posted by grapes911
I have thought about the Energy Saver Scheduler. It doesn't have enough controll. I need different times for each day. Plus, its too easy to turn off.

I have a storage server, but they can run most things locally.
You can lock the Energy Saver so they can't make changes. Only an admin can click the lock and change the settings if you do that. And I think you can AppleScript it, but I'm not sure. Something to look into.

Ah, well then I guess you aren't using OS X server to admin the computers...
__________________
This is not the signature you're looking for.
This is not the signature we're looking for.
You can scroll down now.
You can scroll down now.
Mechcozmo is offline   0 Reply With Quote
Old Mar 19, 2005, 05:31 PM   #5
grapes911
Thread Starter
Demi-God (Moderator emeritus)
 
grapes911's Avatar
 
Join Date: Jul 2003
Location: Citizens Bank Park
Quote:
Originally Posted by Mechcozmo
You can lock the Energy Saver so they can't make changes. Only an admin can click the lock and change the settings if you do that. And I think you can AppleScript it, but I'm not sure. Something to look into.
That would work, but is there anyway to make it shutdown at different times each day?
grapes911 is offline   0 Reply With Quote
Old Mar 19, 2005, 05:43 PM   #6
dotdotdot
macrumors 68020
 
Join Date: Jan 2005
Well how many computers?

My school has one person walking around manually shutting down machines...

You can Password protect the computers and lock the Energy saver thing so no one can turn the computer on again except for people w/ the password, etc...

Maybe there is a 'computer alarm clock?' i think windows may have this feature!
dotdotdot is offline   0 Reply With Quote
Old Mar 19, 2005, 05:45 PM   #7
dotdotdot
macrumors 68020
 
Join Date: Jan 2005
Windows has a program you can download: Active Shutdown - check if this is available for the Mac
dotdotdot is offline   0 Reply With Quote
Old Mar 19, 2005, 05:53 PM   #8
grapes911
Thread Starter
Demi-God (Moderator emeritus)
 
grapes911's Avatar
 
Join Date: Jul 2003
Location: Citizens Bank Park
Quote:
Originally Posted by dotdotdot
Well how many computers?

My school has one person walking around manually shutting down machines...

You can Password protect the computers and lock the Energy saver thing so no one can turn the computer on again except for people w/ the password, etc...

Maybe there is a 'computer alarm clock?' i think windows may have this feature!
About 40 computers. People do walk around shutting them down. Its just that the users get really pissy and we have had incidents where people resort to violence to keep someone from turing off the computer. Security had to come and remove users twice in the last year. Its just a few users over and over again. If the process what automated, (like 'shutdown -h now') it should help the site assistants. I just need more control than a simple 'shutdown -h now'.

Password protecting the computers would be a no. User Services (who controls the lab says we aren't to turn on computers. Once a user turns it on, we can keep it on till close. Its some stupid PC energy conservation things. It would be very annoying to enter a password everytime someone wanted a computer turned on.
grapes911 is offline   0 Reply With Quote
Old Mar 19, 2005, 05:58 PM   #9
Mechcozmo
macrumors 603
 
Mechcozmo's Avatar
 
Join Date: Jul 2004
Simple solution!

Have the computers shut down at a certain time. Say, 2100

At 2105 a cron script runs that shuts down again (just in case)

You walk around and take power cables away. At 2110 again a cron runs (if you need that much time to pull cables out of the computers).

Lock cables in a cabinet. Done. Can't start them up like that.
__________________
This is not the signature you're looking for.
This is not the signature we're looking for.
You can scroll down now.
You can scroll down now.
Mechcozmo is offline   0 Reply With Quote
Old Mar 19, 2005, 06:15 PM   #10
grapes911
Thread Starter
Demi-God (Moderator emeritus)
 
grapes911's Avatar
 
Join Date: Jul 2003
Location: Citizens Bank Park
Quote:
Originally Posted by Mechcozmo
Simple solution!

Have the computers shut down at a certain time. Say, 2100

At 2105 a cron script runs that shuts down again (just in case)

You walk around and take power cables away. At 2110 again a cron runs (if you need that much time to pull cables out of the computers).

Lock cables in a cabinet. Done. Can't start them up like that.
Taking the power cables away is not a viable soluton.

And thank you for trying, but you went right back to the begining. A simple script is not enough. I need control over the script/program to abort it in rare occations. Plus anacron would turn off the computers as soon as they started if there was still a shutdown command left. Not Done.

Now back to my original question, I'll simplify it:
If anyone has an idea on how to stop a script by use password and not using the terminal, please help me.
If anyone has an idea on how to catch a force quit command, please help me.
grapes911 is offline   0 Reply With Quote
Old Mar 20, 2005, 01:25 AM   #11
Dippo
macrumors 65816
 
Dippo's Avatar
 
Join Date: Sep 2003
Location: Charlotte, NC
This won't answer your original question, but if having people reboot the computers is a problem, then a program could be run on startup. The program could check and see how long it has been since the force shutdown (or just check what time of day it is). And then the program can automatically shutdown again or not let the users logon.

If these were Windows machines, then I could help more...alas.
__________________
FAVS - Super Monkey Ball Labyrinth
Dippo is offline   0 Reply With Quote
Old Mar 20, 2005, 10:23 AM   #12
grapes911
Thread Starter
Demi-God (Moderator emeritus)
 
grapes911's Avatar
 
Join Date: Jul 2003
Location: Citizens Bank Park
Quote:
Originally Posted by Dippo
This won't answer your original question, but if having people reboot the computers is a problem, then a program could be run on startup. The program could check and see how long it has been since the force shutdown (or just check what time of day it is). And then the program can automatically shutdown again or not let the users logon.

If these were Windows machines, then I could help more...alas.
This is what I want to do. I'm just now sure exactly how. I have a good amout of programing experience, I just don't know where to start. If this were linux, I'd have the rc files check for time of day and not allow the boot. I just don't think its a good idea to touch the rc files on a mac.
grapes911 is offline   0 Reply With Quote
Old Mar 20, 2005, 06:29 PM   #13
Mechcozmo
macrumors 603
 
Mechcozmo's Avatar
 
Join Date: Jul 2004
Quote:
Originally Posted by grapes911
This is what I want to do. I'm just now sure exactly how. I have a good amout of programing experience, I just don't know where to start. If this were linux, I'd have the rc files check for time of day and not allow the boot. I just don't think its a good idea to touch the rc files on a mac.
Can't you write a program that, on startup:
-Writes a file owned by an admin to the hard drive somewhere and writes to it again on shut down
-Checks to see if the last shut down time written was. If it was over X hours ago, then it allows you to continue starting up. If the last shut down time was only a short while ago, it gives you a box that allows you to enter an administrator's password or click on a "Shut Down" button.

So say someone restarts a computer when they weren't supposed to. Upon startup (after the OS has been initialized and before the login screen is a System Startup Items, and after you log in are Login Items. There is a difference between the two-- you want to make a System Startup Item) the program checks this file. Because it has been less than a specified amount of time, the program asks them to either enter an Administrator password or click on Shut Down. If they enter the password (say you are troubleshooting) then it allows the login window to appear. If they don't, they must shutdown. Or it will shut down automatically after 5 minutes.
__________________
This is not the signature you're looking for.
This is not the signature we're looking for.
You can scroll down now.
You can scroll down now.
Mechcozmo is offline   0 Reply With Quote
Old Mar 20, 2005, 08:53 PM   #14
GeeYouEye
macrumors 68000
 
GeeYouEye's Avatar
 
Join Date: Dec 2001
Location: State of Denial
Send a message via AIM to GeeYouEye Send a message via Yahoo to GeeYouEye
You could install something that I think is called MacSMBPop (or something like that) that works like the smbclient message pop-ups on windows, to warn people that the computers will be shut down in X minutes, use the shutdown -h now (or whatever it was) command, and once it's done, kill the power at the circuit breaker. No one will reboot after that. >:D
__________________
I bring order to chaos. You are in chaos Windows, you are the contradiction, a bug wishing to be an OS.
Visit Softyards Software
NEW DEFINITION OF GEEK
Like politics, free speech, computers, entertainment, and more? Join us at Wordforge.net
GeeYouEye is offline   0 Reply With Quote
Old Oct 7, 2005, 07:44 PM   #15
jdogg
macrumors newbie
 
Join Date: Oct 2005
I noe What u need

http://softwares.bajram.com/utilities/#Super_Shut_Down
its a beta though it has a timer and all u need and want enjoy and i hope it helps!!


p.s i had to register to post this lol ) hahha



{peace}
jdogg is offline   0 Reply With Quote
Old Oct 9, 2005, 12:52 PM   #16
grapes911
Thread Starter
Demi-God (Moderator emeritus)
 
grapes911's Avatar
 
Join Date: Jul 2003
Location: Citizens Bank Park
Thanks for trying, but this is not what I wanted at all. It it too easy to cancel (unless I'm missing something). I needed a program that would shutdown the computers so to get the users off them.

I already wrote a program that satisfies my needs. Thanks anyway.
__________________
grapes911 is offline   0 Reply With Quote
Old May 1, 2007, 02:42 PM   #17
forbade
macrumors member
 
Join Date: Mar 2006
Location: US
Quote:
Originally Posted by grapes911 View Post
Thanks for trying, but this is not what I wanted at all. It it too easy to cancel (unless I'm missing something). I needed a program that would shutdown the computers so to get the users off them.

I already wrote a program that satisfies my needs. Thanks anyway.


you could ssh "osascript" commands to execute an applescript on the remote client(s) that will force it to shut down. plus with ssh and osascript you can perform other options as well. Like display whatever dialog you want etc etc.
This also lets you start the shut down process on command if you wish.

if you needed to cancel, the shutdown command (from the cron or even if activated by a remote shell) just kill the PID.

umm. depending on how many computers you administer, would depend on the complexity up the master script from the server.

just ssh to a sudo account on the remote system(s) and execute the osascript you desire. fun fun.
__________________
"Discovery consists of seeing what everybody has seen and thinking what nobody has thought."
Albert Szent-Gyorgyi

Last edited by forbade; May 1, 2007 at 02:45 PM. Reason: adding stuff, cleaning up gr@mm3r
forbade is offline   0 Reply With Quote
Old May 1, 2007, 07:27 PM   #18
ChrisA
macrumors G4
 
Join Date: Jan 2006
Location: Redondo Beach, California
Wire the computers into electric outlets controled by "X10". then after the "shutdown -h" command runs you send a "power off" to the X10 outlets. The AC power is dead so the computers can't be turned back on.
ChrisA is offline   0 Reply With Quote
Old May 1, 2007, 07:35 PM   #19
grapes911
Thread Starter
Demi-God (Moderator emeritus)
 
grapes911's Avatar
 
Join Date: Jul 2003
Location: Citizens Bank Park
Holy Crap!!! Thanks for the advice, but this thread is from 2005!!! I haven't worked there in almost a year. forbade, the the heck did you dig this thing up?
__________________
grapes911 is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Computer shutdown phyx MacBook Pro 1 Apr 5, 2014 03:24 PM
iMac mid 2011 - script for HDD shutdown at startup? drtome iMac 0 Dec 22, 2013 08:19 AM
Shutdown Computer in network via Macbook Jokinha Mac OS X Server, Xserve, and Networking 3 Jun 12, 2013 02:53 AM
Is there a script, plugin or program that allows one click image save in Firefox? blueroom Mac Applications and Mac App Store 1 Apr 6, 2013 12:53 PM
A little problem: Need to bypass shutdown script Ri-dog Mac Basics and Help 5 Jan 18, 2013 09:21 AM

Forum Jump

All times are GMT -5. The time now is 11:32 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC