DanKeller.orgThoughts on technology, family, community and other things that make life awesome.
http://blog.dankeller.org/
Thu, 21 Jul 2016 14:43:59 -0500Thu, 21 Jul 2016 14:43:59 -0500Jekyll v3.1.6AutoPkg at Twin Cities Mac Admins<p>Check out my slides from my talk at today’s <a href="http://www.mspmacadmins.org/2015/03/meetup-march-23-2015/">Twin Cities Mac Admins meetup</a>.</p>
<p>https://speakerdeck.com/dankeller/autopkg-intro</p>
<p>Links:</p>
<ul>
<li><a href="https://github.com/autopkg/autopkg/wiki/More-resources">AutoPkg Resources</a></li>
<li><a href="http://www.lindegroup.com/autopkgr">AutoPkgr</a></li>
<li><a href="http://seankaiser.com/blog/2013/12/16/autopkg-change-notifications/">Sean Kaiser’s AutoPkg change notifocation script</a></li>
<li><a href="https://github.com/sheagcraig/JSSImporter">JSSImporter</a></li>
</ul>
Mon, 23 Mar 2015 14:26:55 -0500http://blog.dankeller.org/free-software/mac/sysadmin/2015/03/23/autopkg-at-twin-cities-mac-admins.html
http://blog.dankeller.org/free-software/mac/sysadmin/2015/03/23/autopkg-at-twin-cities-mac-admins.htmlfree-softwaremacsysadminUsing Ubuntu 14.04 as a Backend for Munki<p><a href="http://clburlison.com/">Clayton Burlison</a> posted <a href="http://clburlison.com/blog/2014/10/06/munkirepo-guide-part-1/">a handy primer</a> on setting up your <a href="https://github.com/munki/munki">Munki</a> repo on <a href="http://releases.ubuntu.com/14.04/">Ubuntu 14.04 LTS</a> with <a href="http://nginx.org/">nginx</a> and <a href="https://github.com/wollardj/mandrill">Mandrill</a>. This is definitely on my to-do list.</p>
Mon, 13 Oct 2014 10:43:31 -0500http://blog.dankeller.org/free-software/mac/linux/sysadmin/munki/2014/10/13/using-ubuntu-14.04-as-a-backend-for-munki.html
http://blog.dankeller.org/free-software/mac/linux/sysadmin/munki/2014/10/13/using-ubuntu-14.04-as-a-backend-for-munki.htmlfree-softwaremaclinuxsysadminmunkiMactracker<p><a href="http://mactracker.ca/">I love it</a>. That is all.</p>
Fri, 03 Oct 2014 12:04:38 -0500http://blog.dankeller.org/free-software/mac/2014/10/03/mactracker.html
http://blog.dankeller.org/free-software/mac/2014/10/03/mactracker.htmlfree-softwaremacCleaning Up /Users<h2 id="the-problem">The Problem</h2>
<p>Working in a school, I often need to clean up the old user folders in /Users on our lab machines. We don’t “freeze” our labs for various reasons, but mostly so the computer behaves as the user expects and they don’t lose the project they were working on simply because they saved it to the computer instead of their flash drive.
Over time, the computer accumulates a lot of home folders!</p>
<p>I sure don’t want to delete them manually.</p>
<h2 id="a-solution">A Solution</h2>
<p>A (dangerous) solution is to script the deletion of the folders. I say it is dangerous because any time you are deleting files with a script, you run the risk of lost data. You have been warned.</p>
<p>I needed the script to only delete folders that had not been accessed in a while. The idea is to delete folders from users who had not logged in at all the current trimester. 90 days should do.</p>
<p>I also needed to keep some local users, an admin account, a special user set up for online testing and a student guest account that gets reset after each reboot.</p>
<p>I used an array to list the folders I don’t want to touch.</p>
<div class="language-bash highlighter-rouge"><pre class="highlight"><code><span class="nv">KEEP</span><span class="o">=(</span><span class="s2">"/Users/Shared"</span> <span class="s2">"/Users/support"</span> <span class="s2">"/Users/student"</span> <span class="s2">"/Users/testing"</span><span class="o">)</span>
</code></pre>
</div>
<p>I used <code class="highlighter-rouge">find</code> with a simple date check on the folder to determine if it should be deleted. Each time a user logs in, it updates files in the folder, therefore updating it’s timestamp. Great!</p>
<div class="language-bash highlighter-rouge"><pre class="highlight"><code><span class="nv">USERLIST</span><span class="o">=</span><span class="s1">'/usr/bin/find /Users -type d -maxdepth 1 -mindepth 1 -not -name "." -mtime +$AGE'</span>
</code></pre>
</div>
<p>I am maintaining my script on <a href="https://github.com/dankeller">github</a>, so feel free to grab it. Again, <em>THIS WILL DELETE DATA AND YOU HAVE BEEN WARNED</em>.</p>
<p>Run it remotely, create a <a href="https://developer.apple.com/library/mac/documentation/MacOSX/Conceptual/BPSystemStartup/Chapters/CreatingLaunchdJobs.html">LaunchAgent</a> and/or use Nate Walck’s neat little <a href="https://github.com/natewalck/Scripts/blob/master/scriptRunner.py">scriptRunner.py</a>.</p>
<p>Happy cleaning!</p>
Thu, 02 Oct 2014 09:08:13 -0500http://blog.dankeller.org/sysadmin/mac/scripts/2014/10/02/cleaning-up-users.html
http://blog.dankeller.org/sysadmin/mac/scripts/2014/10/02/cleaning-up-users.htmlsysadminmacscripts