<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Hi Keifer, <div class=""><br class=""></div><div class="">Depending on the version of OS X you’re using (hopefully it’s a recent one), you might have more reliable script execution using Launchd rather than Cron. </div><div class=""><br class=""></div><div class=""><div class="">For your script, I would stick to bash as you seem to be combining AppleScript and shell script. Make the following text file: </div><div class=""><br class=""></div><div class=""><b class="">#!/bin/sh</b></div><div class=""><b class="">/usr/local/bin/brew update</b></div><div class=""><b class="">/usr/localbin/brew upgrade tor</b></div><div class=""><b class="">echo “script ran at `date`” >> /tmp/torupdate.log</b></div><div class=""><b class="">exit 0</b></div><div class=""><b class=""><br class=""></b></div><div class="">Make the file executable by typing <b class="">sudo chmod +x (filename) </b>in the terminal and pressing enter. You will be prompted for your password. </div></div><div class=""><br class=""></div><div class="">You can easily make a launchd plist file using the online zerowidth tool: <a href="http://launched.zerowidth.com/" class="">http://launched.zerowidth.com/</a> .  Include the complete path to the script you just made in the launchd plist file as the command. Every time it runs it will write to the log file at /tmp/torupdate.log which you can clear by restarting your Mac. </div><div class=""><br class=""></div><div class="">Drop your plist file into /Library/LaunchDaemons or ~/Library/LaunchDaemons and restart your computer to make it take effect. </div><div class=""><br class=""></div><div class="">If this works for you, you may want to start modifying the script to stop Tor as it is being upgraded, restart it afterwards and perhaps add some more logging or alerts. </div><div class=""><br class=""></div><div class="">Good luck! </div><div class=""><br class=""></div><div class="">S</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On 1 May 2018, at 18:58, Keifer Bly <<a href="mailto:keifer.bly@gmail.com" class="">keifer.bly@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">Hello,<br class=""><br class="">So on Mac OS X, I am using crontab to automatically run a script I wrote for Mac OS High Sierra to automatically update the tor relaying software every day at 1am.<br class=""><br class="">The cron command I am using is this: 0 1 * * * /Users/oldimac/Desktop/update\ tor.scpt<br class=""><br class="">The script I wrote seems to work fine for updating tor, however it seems to have trouble updating homebrew.<br class=""><br class="">Here are the contents of the script:<br class=""><br class="">do shell script "$ which brew<br class="">/usr/local/bin/brew update"<br class="">do shell script "$ which brew<br class="">/usr/local/bin/brew upgrade tor"<br class="">end<br class=""><br class=""><br class="">When the script is run, the output is this:<br class=""><br class="">sh: $: command not found<br class="">Error: tor 0.3.2.10 already installed<br class=""><br class="">So it seems to be that it updates tor ok but when it tries to update homebrew the error is “command not found”.<br class=""><br class="">I previously tried do shell script “brew update” however that only turns to a "command not found" error and only works in terminal but not AppleScript.<br class=""><br class="">Also, after writing the crontab command, I launched crontab via terminal via running “crontab” which loads to a blank Terminal screen. Do you know of a way I can check the script actually ran?<br class=""><br class="">Thank you very much.<br class=""><br class=""><br class=""><br class=""><br class="">_______________________________________________<br class="">tor-relays mailing list<br class=""><a href="mailto:tor-relays@lists.torproject.org" class="">tor-relays@lists.torproject.org</a><br class="">https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-relays<br class=""></div></div></blockquote></div><br class=""></div></body></html>