This launchd daemon is a system daemon (not a user agent) and is designed to run the script file upon wakeup from sleep
the install code:
#!/bin/sh
#find current working directory. store as $curr. use to reference anything in $curr/mysecureview.
curr=$(pwd)
echo "+copy the plist to the system daemons directory."
cp $curr/sleepwatcher/config/sleepwatcher.system.plist /System/Library/LaunchDaemons/sleepwatcher.system.plist
echo "+create the /etc/mysecureview directory to contain all program files."
sudo mkdir /etc/mysecureview
echo "+copy the log file to contain the compiled set of log entries."
sudo cp $curr/log.txt /etc/mysecureview/log.txt
echo "+create the file to contain the individual set of pre-compiled log-entries."
sudo mkdir /etc/mysecureview/logs
echo "+copy the shell script to be used at bootup/wakeup"
sudo cp $curr/sleepwatcher/config/rc.wakeup /etc/mysecureview/rc.wakeup
echo "+move imagesnap"
sudo cp $curr/imagesnap-master/imagesnap /etc/mysecureview/imagesnap
#establishing root ownership of /etc/mysecureview/
#sudo chmod 700 /etc/mysecureview
#echo "+establishing root ownership of /etc/mysecureview/"
echo "========================"
echo "~Installation Succesful~"
echo "========================"
The plist:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>sleepwatcher.system</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/sbin/sleepwatcher</string>
<string>-V</string>
<string>-w /etc/mysecureview/rc.wakeup</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<true/>
</dict>
</plist>
The script itself:
#!/bin/sh
sudo cd /etc/mysecureview/
sudo ./imagesnap
./imagesnap takes a picture and places it in the same directory. the file is named "snapshot.jpg". I've searched the entire mac, and there isn't any .jpg with this name. I think the issue is with creating or installing the plist, but searching the OSX developer page on launchd isn't much of a help.