if you want to receive [pc start] msg, put the file into /Library/LaunchDaemons/. other way,to put this file into /Library/LaunchAgents so that you can receive the msg to kown someone has logined into your system.
put the shell script file into /usr/local/, and give other user execute permission in the terminal with below cmd: sudo chmod o+x /usr/local/pcMonitorService.sh
it's the program logic that will be executed actually. like pcMonitorService.sh, you should put this gay into /usr/local/. and you should modify somewhere which I havd marked as "#TODO", mostly they are about the e-mail.
ok,now you should give the user which you want monitor more permission, such as, shutdown. yeah, shutdown! I konw it seems to be very dangerous, but you must do that, if you want it looks like fascinating！ first,modified shutdown shell sudo vi /sbin/shutdown then change the line contain: %users localhost=/sbin/shutdown -h now to (remove the first sharp symbol): %yanghua localhost=/sbin/shutdown -h now notice:yanghua is just my pc's user name
set the suid for the user of the pc that you want to monitor in the Treminal: sudo chmod u+s /sbin/shutdown
added screen shot when the network is unable and handled method:"init" exception at Fri Feb 8.
more information, please go and see my blog: http://blog.csdn.net/yanghua_kobe/article/details/8576106
and if you have any problem, give me your mail: email@example.com