n4vig4t0r Posted May 21, 2017 Share Posted May 21, 2017 I am trying to write a script that will take a snapshot, then exit Debut and exit the script. In future I want to schedule the script to run every 10 minutes or so during daylight hours, but that can wait for now. The script is starting from the command line and taking the snapshot just fine but then it does not exit Debut or the script. #!/bin/bash echo “About to launch Debut and take a snapshot!” /Applications/Debut.app/Contents/MacOS/Debut -snapshot -source "webcam" -ms 1000 /Applications/Debut.app/Contents/MacOS/Debut -exit { sleep 1m kill $$ } & while true do date sleep 1 done Link to comment Share on other sites More sharing options...
macfly Posted May 22, 2017 Share Posted May 22, 2017 Try changing the script to the following: #!/bin/bash echo “About to launch Debut and take a snapshot!” /Applications/Debut.app/Contents/MacOS/Debut -snapshot -source "webcam" -ms 1000 & sleep 15 /Applications/Debut.app/Contents/MacOS/Debut -exit For the periodic recording every 10 minutes, you can create a launchd plist and use launchctl to load/unload it. Example: 1. Create a debutlauncher.plist text file in your /Users/<username>/Library/LaunchAgents folder with following contents. Where /Users/myusername/Documents/debutlauncher.sh is the absolute path to the script above <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Label</key> <string>debutlauncher</string> <key>ProgramArguments</key> <array> <string>/Users/myusername/Documents/debutlauncher.sh</string> </array> <key>StartInterval</key> <integer>600</integer> </dict> </plist> 2. In Terminal, cd to the /Users/<username>/Library/LaunchAgents folder then run 'launchctl load debutlauncher.plist' 3. If you want to remove the scheduler run 'launchctl unload debutlauncher.plist' in the same folder Link to comment Share on other sites More sharing options...
n4vig4t0r Posted May 22, 2017 Author Share Posted May 22, 2017 Thanks macfly, I will try those suggestions Link to comment Share on other sites More sharing options...
n4vig4t0r Posted May 27, 2017 Author Share Posted May 27, 2017 Hi macfly, I am using Mac OS Sierra 10.12.5, I have created the scripts described and am now trying to save the debutlauncher.plist, I can see /Users/<username>/Library/ but there is not a 'LaunchAgents' folder present within this folder. Do I need to expose it by changing permissions somehow? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now