Here's a challenge. I want to change the screen saver on a mac mini, running OSX, from a browser anywhere in the world.
You may well ask why ... the screen of the mac mini is to be visible at Well House Manor where it will provide an information screen at the front door when it's not otherwise in use, and we want it to say things like "Sorry - no Vacancies" and "Welcome to the Chamber of Commerce"

Task achieved! Using PHP ... and Perl ... and Web2 technology. With a smattering of OSX!
Here's the control widget on our web page ... the page is in PHP and this particular widget is only displayed to staff members who are logged in - if you look at our
Staff Resources Page you won't see it.
And the
PHP that's run when you press the update button:
if ($_POST[door] == 12) { // Door Status changed
$ds = $_POST[doorst];
$fho = fopen("door.txt","w");
fputs ($fho,stripslashes($ds)."\n");
fclose ($fho); // Host and Port changed for security
$done = file("http://zzz.wellho.net:8080/cgi-bin/dodo.pl?$ds");
}
That piece of viewing software was called a controller on the Mac - which is running as a Web Server on a port enabled on our firewall, and redirected with NATS to the Mac Mini.
The
Perl software dodo.pl looks like this:
#!/usr/bin/perl
print "content-type: text/html\n\n";
print "Changing Page";
`rm -rf /Users/lisaellis/FrontDoor`;
`cp -r /Users/lisaellis/$ENV{QUERY_STRING} /Users/lisaellis/FrontDoor`;
open (FH,"ps aux|");
while (<FH>) {
if (/ScreenSaverEngine/) {
@n = split;
kill 9,$n[1];
print "$n[1]<br>";
}
}
sleep 1;
open (FH,'|/System/Library/Frameworks/ScreenSaver.framework/Versions'.
'/A/Resources/ScreenSaverEngine.app/Contents/MacOS/ScreenSaverEngine' );
close FH;
print "Changing Page";
And there's also a standalone version
here if you want to download a copy for your own use.
You'll notice - typical use of PHP to front a web application, typical use of Perl as "glueware", and typical use of a Unix / Linux / OSX utility - in this case Mac's ScreenSaverEngine - to do the oddball job we needed.
(written 2008-05-06 17:49:19)
Associated topics are indexed under
A164 - Web Application Deployment - Services and Regular Jobs [2182] What Linux run level am I in? - (2009-05-15)
[2145] Using the internet to remotely check for power failure at home (PHP) - (2009-04-29)
[1903] daemons - what is running on my Linux server? - (2008-11-23)
[1765] Dialects of English and Unix - (2008-08-21)
[1733] memcached - overview, installation, example of use in PHP - (2008-08-02)
[1731] Apache httpd, MySQL, PHP - installation procedure - (2008-08-01)
[1700] FTP server on Fedora Linux - (2008-07-06)
[1553] Automatic startup and shutdown of Tomcat - (2008-02-24)
[1288] Linux run states, shell special commands, and directory structures - (2007-08-03)
[1028] Linux / Unix - process priority and nice - (2007-01-10)
[907] Browser -> httpd -> Tomcat -> MySQL. Restarting. - (2006-10-28)
[544] Repeating tasks with crontab - (2005-12-27)
H307 - PHP - Web2 and caching [2545] Scraping content for your own page via PHP - (2009-12-21)
[2321] Uploading and Downloading files - changing names (Perl and PHP) - (2009-08-04)
[2196] New Example - cacheing results in PHP for faster loading - (2009-05-24)
[1995] Automated server heartbeat and health check - (2009-01-16)
[1926] Flash (client) to PHP (server) - example - (2008-12-06)
[1814] Javascript/HTML example, dynamic server monitor - (2008-09-28)
[1813] Ajax - going Asyncronous and what it means - (2008-09-28)
[1812] Starting Ajax - easy example of browser calling up server data - (2008-09-27)
[1647] Exchange Rates - PHP with your prices in your users currency - (2008-05-19)
P258 - Perl - Solaris, OSX and Linux [2022] Pre and post increment - the ++ operator - (2009-02-03)
[1702] Running operating system commands in Perl - (2008-07-08)
Z402 - Melksham Chamber of Commerce and Industry [2594] Melksham Area - your community view is sought - (2010-01-23)
[2568] Forums for your Melksham and open source discussions - (2010-01-09)
[2546] How well do you know Melksham - a quiz for Christmas - (2009-12-21)
[2544] Vision for Wiltshire - (2009-12-20)
[2531] Melksham - new Tuesday Market - (2009-12-09)
[2521] Melksham Market - Tuesdays, 09:00 to 14:00 - (2009-12-01)
[2514] The road show has been - where now? - (2009-11-27)
[2508] Community Area Partnership - inaugural AGM - (2009-11-20)
[2495] Planning the future of Wiltshire - (2009-11-07)
[2487] Melksham Forum - (2009-11-01)
[2465] Melksham Town - asleep or awake? - (2009-10-21)
[2459] New Web Site for Melksham Chamber of Commerce - (2009-10-18)
[2437] Wiltshire Unitary News - Chamber of Commerce Intelligence - (2009-10-04)
[2328] Melksham - no trains, no southbound buses through the town - (2009-08-08)
[2289] pre-Inaugural briefing - Melksham Community Area Partnership - (2009-07-15)
[2288] Wiltshire Community Area Partnerships - (2009-07-15)
[2260] Important - the future of Melksham / Chamber of Commerce - (2009-06-28)
[2220] Melksham Traders - where do we go? - (2009-06-05)
[2194] Melksham Business Map - Chamber of Commerce, Tourist Information and Town Council - (2009-05-21)
[2181] You cannot please all of the people all of the time - (2009-05-14)
[2119] Make your business a DESTINATION business - (2009-04-05)
[2111] Business Networking for Melksham - 23rd April - (2009-04-01)
[2095] Blue Ridge and Melksham Chambers of Commerce - (2009-03-21)
[2043] Confidence, Customer Service and Tourism in Melksham - (2009-02-15)
[1987] One Cheer for Local Democracy - Asda in Melksham - (2009-01-11)
[1979] Looking forward, in Melksham, in 2009 - (2009-01-05)
[1934] Lidl opens in Melksham - (2008-12-11)
[1904] Ruby, Perl, Linux, MySQL - some training notes - (2008-11-23)
[1892] Melksham Chamber of Commerce and Industry - (2008-11-17)
[1881] Wiltshire Council says - part 1 - (2008-11-13)
[1792] All the pieces fall into place - hotel and courses - (2008-09-10)
[1748] Hotel room prices - Melksham, Wiltshire - (2008-08-11)
[1642] Summer! - (2008-05-15)
[1507] Comments on proposed Asda Superstore for Melksham - (2008-01-14)
[1504] Flooding by Asda-s proposed new supermarket - (2008-01-12)
[1476] Shopping for Christmas and looking forward - (2007-12-17)
[1432] Wiltshire County Council - Budget Consultation - (2007-11-15)
[1429] Remembrance day - inside a church and inside the day - (2007-11-11)
[1250] Business speed networking - a place tonight! - (2007-06-28)
[1223] Asda opening large new store in Melksham - (2007-06-08)
[717] A customer service company - (2006-05-11)
Some other Articles
Providing exceptional service - and carrying on doing so.What to do if the Home Page is missingSpring in DevizesKiss and BookChanging a screen saver from a web page (PHP, Perl, OSX)Lua - a powerful, up and coming scripting languageLooking back through some photosTo provide external links, or not?A short introduction to our coursesGant charts - drawing them with a PHP script