PDA

View Full Version : Getting system time via applescript or shell script



DamosMac
25th September 2012, 10:59 PM
Hi,
I've got what I believe is a simple enough idea.. but I can't work out how to do it lol.

I have a mac mini running 10.7.5 Server. Its powered by a UPS which OSX doesn't support. HOWEVER, there is a PC plugged into the same UPS, which I'm running the software on. It will have the ability to login to the mac via ssh and run some commands to shut it down.. But as its a mail server I want it to power back up again..

So.. what I want to do is as part of the shutdown script the PC runs on the mac, I want to set the wake up time for say 30 minutes into the future.. but I'm not sure how to get system time & date, and add 30 minutes and then use them both in the final command:

pmset schedule wake "todays date time+30 minutes"

guessing it could be done using some kind of variables etc.. but im not much good with them..

soulman
30th September 2012, 11:59 PM
With AppleScript:

set nowTime to (current date)
set nextTime to nowTime + 30 * minutes

Or just:

set nextTime to (current date) + 30 * minutes