Wake on lan doesn't wake up the display of OSX Mavericks - applescript

I updated to OSX 10.9.5 and realized that one function pipeline that I used flawlessly is now broken.
I send a wake-on-lan magic packet to my OSX from my Raspberry Pi which successfully wakes up the OSX, but unlike before the iMac's display stays dark. Previously the display also brightened up. The problem is not that particularly, but that when I run an applescript through SSH the iMac goes back to sleep by itself in the middle of running and I have to wake it up again to finish the interrupted script. I have setup my energy saving to "Never" so it shouldn't do that.
I even tried running a script that actually sets the brightness of iMac's display to highest, but that doesn't wake up the display either.
Only when I take a VNC connection or move the local USB mouse the display wakes up and OSX won't go back to sleep by itself.

I found a solution for this. Just run this on the remote OSX's terminal:
caffeinate -u -t 1
It will wake up the display immediately. I found the solution from this blog

Related

raspberry pi3 can not launch application on primary HDMI Display, can launch on remote using ssh -x

I had built console core image for raspberry Pi3, and I am able to boot the Rpi3 successfully using SD card.
I have created an electron app which is able to launch on remote display over ssh.
However when I launch the application on Monitor connected through HDMI Cable, It gives following error
Can not open Display :0.0
I have seen many people asking this question for not able to launch on remote display, which works fine in my case.
Can anyone help in this?
With console core, you don't have an X server running to display on.
You can upgrade your system to include the X installation -- search for 'install pixel desktop' -- or you could just refresh the card with the lite or full image.
If you set the Pi to auto login to the pi account, you can start your application on login by adding it to the bottom of .xinitrc. You could also start it from a remote ssh, displaying on the local display, by setting DISPLAY=:0 in the environment before you start. You'll need to explore the world of X Windows authentication to make this work. See the man page for the xhost command, for instance.
(This is an expansion of LetoThe2nd's comment, which probably should have been an answer instead.)
Console core image means that there is no xserver running, and hence no display :0. Try getting started with core-image-x11 maybe, or whatever suits the RasPi.

Forgotten where I left an automatic shutdown script on Mac OSX

I let me Parallels Desktop running Windows XP to start automatically during mac log-in. And to start Windows upon launch to let my dad use his WinXP by just pressing the power button, bypassing the Mac login window and desktop completely. When he shuts down Windows, Parallels closes.
I seem to remember I have a trigger to shut down mac as soon as Parallels closes. But I don't remember where... I have an AppleScript that tells Finder to shut down. I understand that. But now the problem is Mac shuts down AS SOON AS it boots up every time! I can't figure out what's triggering the shutdown... And I've run out of places to look.
It seems like a normal shut down rather than a fatal error. Seems like someone has chosen the 'Shut Down' command as soon as Mac starts up. So could mac gurus suggest places I should look -- what might have triggered this -- I'm pretty sure it's Parallels-related. Maybe there is something in the Package Contents linked to the shutdown script??
You added the Applescript (that shut down the mac) to login items

osx lion never stays in sleep mode

Since I updated to OSX Lion I got a strange issue.
I am used to never shut down my Mac, I simply put it in hibernate / sleep mode.
But since the update to Lion the mac just starts up at random times.
Day and Night I can hear the CD-Drive sound when it wakes up.
The screen does not even go on, it stays black but the as soon as you hit any key the monitor just turns on.
This is really annoying as it sometimes wakes you up at night when you MAC is booting up.
I could not find a similar issue reported yet.
Thanks
Sebastian
Given the RTC (Alarm) wake reason, ensure Wake for network activity is turned off. See the last comment in the thread at https://discussions.apple.com/thread/3247367?start=0&tstart=0
Also ensure you have not scheduled wake. See http://osxdaily.com/2010/07/17/why-mac-wakes-from-sleep/
Launch the Terminal and type the following at the command line:
syslog |grep -i "Wake reason"
OHC: stands for Open Host Controller, is usually USB or Firewire. If you see OHC1 or OHC2 it is almost certainly an external USB keyboard or mouse that has woken up the machine.
EHC: standing for Enhanced Host Controller, is another USB interface, but can also be wireless devices and bluetooth since they are also on the USB bus of a Mac.
USB: a USB device woke the machine up
LID0: this is literally the lid of your MacBook or MacBook Pro, when you open the lid the machine wakes up from sleep.
PWRB: PWRB stands for Power Button, which is the physical power button on your Mac
RTC: Real Time Clock Alarm, is generally from wake-on-demand services like when you schedule sleep and wake on a Mac via the Energy Saver control panel. It can also be from launchd setting, user applications, backups, and other scheduled events.
Hope this fixes your problem.

How to detect when OS X Screen Sharing is active programmatically?

OS X does not make it obvious that you might've left a screen sharing session open -- and it's still actively broadcasting your session to these other computers. Does anyone know where Snow Leopard stores that the computer you're sitting at has an open screen sharing session?
If I could detect this file using a shell script every minute or so, then I could fire a Growl notification to let me know that I'm essentially being watched by this other computer (using the code snippet found here).
Otherwise, the only way to know now is to notice a very small icon on the top right of my screen that looks like binoculars (very hard to notice).
One way would be to use lsof to check for any established connections by AppleVNCServer
lsof -a -i :vnc-server -sTCP:ESTABLISHED -c AppleVNCServer

How to force Mac to into dirty shutdown state on every power off?

As Far as I can tell no one has actually solved this debacle.
How do you get a mac mini to power on every time the UPS it is connected to restores power?
It is easy enough to have the UPS communicate that power is about to turn off so have the mac run the command halt -u, or shutdown -h -u, etc, and many solutions such as powerchute from APC guarantee that it will shutdown etc. But it is not guaranteed that the mac will turn back on. If this bit/ file was permanently set so mac the mac believed that it dirty shutdown every time, whatever hardware is responsible for the power sensing of the power restored would always boot the mac when power is restored, even if the mini was powered off during while it booted. Currently if your mini powers off without dirty shutdown being set you are boned, and you must physically press the power button on the back for it to restart, which is unacceptable if the mini is says 5000 miles away or at the bottom of the ocean. You should be able to get this functionality even if no UPS is involved just by having the mac always try to reboot when power is restored. Has anyone ever figured this out?
Have you checked the setting in the Energy Saver preference panel?
System Preferences
-> Energy Saver
-> Options
-> Restart automatically after a power failure
Or see man pmset:
$ pmset -a autorestart 1
Ned almost had the answer - it's on [the man page][1](Apple copy, currently broken) he mentioned.
pmset schedule [cancel] type date+time [owner]
-g sched displays scheduled startup/wake and shutdown/sleep events.
Have a shutdown script run pmset to schedule the system to wake up half an hour or so (let the power stabilize and the UPS time to recharge) from now.
Oh, and BTW: looking through the output of pmset -g everything, I see:
INVOKE: pmset -g ups
UPS settings:
haltlevel off 0
haltafter off 0
haltremain off 0
[1]: Oddly, Apple has taken down its web-formatted man pages; best I can find: http://www.manpagez.com/man/1/pmset/

Resources