arethinn: glowing green spiral (Default)
I need a tool/application/doo-hickey that will allow me to remotely shut down a Mac (probably 10.4 by the time I need to do this, but possibly 10.3.x), more precisely a bunch of Macs, over a network. It needs to have the following capabilities or options:

1. Allow me to specify how long after the program is run the computer will shut down. I prefer being able to specify a clock time, but # of seconds is ok too. It must be manually invoked -- not something that is only capable of being pre-scheduled.

2. Be able to be run from the equivalent of a batch file (whatever that means in the Mac world -- I don't know anything about operating from the OS X command line, only a Windows one, but I can learn). Having to click something per station is not satisfactory, as I could potentially need to shut down up to 90 computers with this thing.

3. Pop up a box for the user so they can see the countdown, and allow me to configure a message in that box.

4. Not be closeable or cancelable by the average user (I don't expect protection against specialized knowledge of killing processes or whatnot).

5. Be configurable to not offer the option to save changes on any open files, i.e., to simply pull the rug out from under the user if that's what I desire.

6. A configurable timeout would be a huge bonus. The network is extremely squirrely (fur in the cables and everything; you have no idea) and I don't want to have a station be skipped just because the program didn't wait long enough, or conversely, to spend too much time trying to connect to one in the middle of a row that is already off (which Shouldn't Happen, but sometimes does anyway).

The current setup (for PCs exclusively) is that I run psshutdown.exe by executing one batch file per row of 10, which has proven to be the most practical way to do it. Right now we only have 6 Macs, which are rarely used, so I've been ignoring the very-occasional case of someone still using one at closing time. Sometime within the next year, however, we are going to have a room full of dual-booting iMacs. While the practical likelihood is that they will mostly be booted to Windows (thus, psshutdown will still work, I hope), I won't have any control over which are in what OS state when, so I'll have to alter said batch files on the fly every night so that the correct program is attempting to run on a given station (unless someone knows of a program, preferably for Windows although it would be doable to have me log into one of said Macs to run it, that will remotely shut down either/or!).

I imagine something like this exists, I just don't know where to go looking for it. Halp plz!

Date: Jun. 27th, 2007 12:12 am (UTC)From: [identity profile] twopiearr.livejournal.com
might want to post this [livejournal.com profile] macosx - you will likely get one or two really snarky answers, but there's a core group of competent geeks who will probably point you in the right direction.

Date: Jun. 27th, 2007 12:29 am (UTC)From: [identity profile] starlightforest.livejournal.com
What? I don't have enough competent geeks on my flist? :P

Date: Jun. 27th, 2007 12:32 am (UTC)From: [identity profile] twopiearr.livejournal.com
that specialize in OS X specifically? hard to say...

Date: Jun. 27th, 2007 01:24 am (UTC)From: [identity profile] rhiannasilel.livejournal.com
Not sure if there's an actual utility, but some kind of bash script using shutdown should work. Here's the man page for the shutdown command from my mac:

SHUTDOWN(8) BSD System Manager's Manual SHUTDOWN(8)

NAME
shutdown -- close down the system at a given time

SYNOPSIS
shutdown [-] [-h [-u] | -r | -k] [-o [-n]] time [warning-message ...]

DESCRIPTION
The shutdown utility provides an automated shutdown procedure for super-
users to nicely notify users when the system is shutting down, saving
them from system administrators, hackers, and gurus, who would otherwise
not bother with such niceties.

The following options are available:

-h The system is halted at the specified time.

-r The system is rebooted at the specified time.

-k Kick everybody off. The -k option does not actually halt the
system, but leaves the system multi-user with logins disabled
(for all but super-user).
:


....basically this will do everything you need to do, we'd just need to put it into a hand bash script (or maybe an Apple Script, but honestly I've never worked with Apple Scripts before). I found this link that may help:

http://www.oreillynet.com/pub/a/mac/2003/11/07/scripting_osx.html

Bash is basically like batch files in Windows except they work better.:)

I'll see if I can come up with something and test it for you, but I'd have to test it from one of my Linux machines so it wouldn't actually be a true test.

Date: Jun. 27th, 2007 02:03 am (UTC)From: [identity profile] starlightforest.livejournal.com
This sounds like it's meant to be run on the server that a number of terminals are logged into, which isn't our setup here. Also it doesn't seem to include anything about powering off the computer in question, which is a specific meaning of "shutdown" I ought to have clarified as a requirement.

Date: Jun. 27th, 2007 02:31 am (UTC)From: [identity profile] rhiannasilel.livejournal.com
You would have to ssh into the machine to execute the command. This can be done with putty on a windows machine. Shutdown will work on any mac, but it has to be executed as root. For what you need, something like this would work:

sudo shutdown -h +5 "system going belly-up in five minutes"

It'd have to be tested, of course, but it should work.

So, basically, what you'd need to do is ssh to the Mac using putty and execute that command. You may even be able to ssh with Cygwin, but I'm not sure. Putty would probably be the easiest.

On the mac side, go to Preferences-->Sharing-->Remote Login and start this service. If you don't do this, you won't be able to ssh to your mac.

Here's a thread on a forum for someone in almost your exact situation:

http://softwares.bajram.com/utilities/#Super_Shut_Down

...and this suggestion may work:
http://softwares.bajram.com/utilities/#Super_Shut_Down

I think your best bet is a quick script using ssh though.

Date: Jun. 27th, 2007 03:04 am (UTC)From: [identity profile] starlightforest.livejournal.com
"You would have to ssh into the machine to execute the command."

To the individual stations, you mean? (I definitely can't ssh to the server.) One at a time? Or by "script" are you saying I can construct something which will automate the process and do the work of logging in to each individual machine, issuing this command, and then moving on to the next one.

On the mac side, go to Preferences-->Sharing-->Remote Login and start this service. If you don't do this, you won't be able to ssh to your mac.

This doesn't sound good. I definitely don't want J Random User to be able to ssh into the station, and the student login doesn't have a password (yes yes, I know, but I am not the sysadmin, and even if they did have a password, all the students would, obviously, have to know it).

Date: Jun. 27th, 2007 03:10 am (UTC)From: [identity profile] starlightforest.livejournal.com
Both your links were the same.

That application is kind of cool, but I don't see remote execution functionality (it looks like it would need to be run separately on each machine), and it appears that full control remains in the hands of the user (what is meant by "you can force the shutdown" is not clear). I'll have to try it on one of the Macs tomorrow though.

Date: Jun. 27th, 2007 04:02 am (UTC)From: [identity profile] rhiannasilel.livejournal.com
Do you shut these down at a specific time each evening? If so, you may be able to schedule what is known as a cron job to do the work for you or, and this looks even easier, you can create a periodic job. Basically, write a script and then schedule it. Periodic jobs are easier, because you just write the script and put it in the /etc/periodic/daily folder. Here's a good link describing both possible functions:

http://developer.apple.com/documentation/MacOSX/Conceptual/BPSystemStartup/Articles/Daemons.html

...and ACK! No password for the student login? There's a scary thought for you. Of course depending on how tight your IT department locks down that user they may not be able to do much, anyway, unless they can find the root password, which, hey, it's a college so I'm sure there are a few people there who could find it. One nice thing about Macs is you can actually lock down user access a bit more than you can on a Windows machine -- or should I say a bit more effectively.

As for ssh you might be able to restrict ssh capability to specific users. That's something you'd have to ask someone with a bit more security knowledge than I have. If this was the case, that would be one option, but yeah, you'd have to go into each one on some level or another or you could write a script that calls a list of servers, ssh's to them, prompts for the password and then executes a specific command. We had something like that at SunRocket on our Linux machines, but the logic should work on a Mac. But, again, this would involve using ssh.

Date: Jun. 27th, 2007 04:03 am (UTC)From: [identity profile] rhiannasilel.livejournal.com
Yeah, I'm not entirely sure it would really do what you need it to do. You may want to post to that forum that I saw it on, though. The user who originally posed it appears to still be around and they may have found a solution they would be willing to share, especially since they appear to have been in a very similar environment.

Date: Jun. 27th, 2007 05:56 am (UTC)From: [personal profile] michiexile
michiexile: (Default)
Setup right you can make sure that ssh from one specific machine won't prompt for passwords (keywords: ssh-agent and public key authentication). With that in place you can write a script that runs from one machine, logs on to all others and runs shutdown there, possibly with a dialog popping up as well.

When ssh is setup, you want to restrict login to only the user that shuts it down - which probably would be root or admin or something.

Date: Jun. 27th, 2007 06:41 am (UTC)From: [identity profile] starlightforest.livejournal.com
This sounds like needing way more control than I have over these machines. Again, I am not the sysadmin. I can request that I be given appropriate permissions to shut down a machine (as I was for the Windows command), but I can't make any such thing happen myself.

Date: Jun. 27th, 2007 06:43 am (UTC)From: [identity profile] starlightforest.livejournal.com
Do you shut these down at a specific time each evening?

Yes, except it's different on Fridays, and as I said, it really needs to be something manually executed because it's not always the same things that need shutting down. (As it sits now it's just a row-by-row difference; in the new situation, it will be a station-by-station difference.)

All of what you are suggesting/describing sounds like requiring way more access and/or control (...over the IT dept) than I actually have, or can hope to have. Oh well. TY anyway.



Date: Jun. 27th, 2007 06:59 pm (UTC)From: [identity profile] unseelie.livejournal.com
Steve
one of my oldest friends
he charges around $130 an hour as a consultant;
you get help free!



Can I get the perosn's info direct? i can help.

there are a couple of options

Apple Remote Desktop will do it
a task server will do it

Givee them my contact info, I don't mind talking to them

--
Steve Favarger
Favarger Consulting
Making Technology the Solution
c) 310.466.4876
steve@favarger.net
http://www.favarger.net

Date: Jun. 28th, 2007 11:07 pm (UTC)From: [identity profile] starlightforest.livejournal.com
I'll shoot him a mail. TY!

Profile

arethinn: glowing green spiral (Default)
Arethinn

July 2025

S M T W T F S
  12345
6789101112
13141516171819
20 2122232425 26
2728293031  

Expand Cut Tags

No cut tags

Style Credit

Page generated Jan. 19th, 2026 07:19 am
Powered by Dreamwidth Studios