Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the '10.5: Start screen sharing remotely in Terminal' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.5: Start screen sharing remotely in Terminal
Authored by: kiezpro on Mar 14, '10 01:02:53PM
Thanks for the hint! I've put together a quick shell script which pretty much works like a Linux start-/stop-script to enable or disable Screen Sharing on my machines. It's quite self explanatory and looks like this:

#!/bin/bash

LAUNCHD_FILE=/Library/Preferences/com.apple.ScreenSharing.launchd

if !( groups | grep -q admin ); then 
	echo "Must be admin to run this script"
	exit 1
fi

case "$1" in 
	status)
		if [[ -e $LAUNCHD_FILE ]]; then
			echo 'Screen Sharing is enabled';
			exit 0;
		else
			echo 'Screen Sharing is not enabled';
			exit 1
		fi
		;;
	start)
		echo -n enabled > $LAUNCHD_FILE
		;;
	stop)
		rm -f $LAUNCHD_FILE
		;;
	*)
		echo "Usage: $0 {status|start|stop}"
esac


[ Reply to This | # ]