Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
# NOTE: this is an OSX launchd wrapper shell script for Tomcat (to be placed in $CATALINA_HOME/bin)
CATALINA_HOME=/Users/username/tomcat
function shutdown() {
date
echo "Shutting down Tomcat"
$CATALINA_HOME/bin/catalina.sh stop
#!/bin/bash
# Provide user info about the computer
# Kris Payne
# run this shiz in a policy in Self Service. It will let the user copy their IP or Computer name for you.
# slower than >System Preferences>Network ? Yes. Easier to explain? Yes.
# Definitions
thisComputerName="scutil --get ComputerName | pbcopy"
thisIPAddress=$(ifconfig | grep "inet " | grep -v 127.0.0.1 | awk {'print $2'} | pbcopy)
#!/bin/bash
# Check for expiring password, then prompt to change with cocoaDialog
# Kris Payne
# Variables
user=`ls -l /dev/console | awk '{ print $3 }'`
pwdThreshold=7
pwdPolicy=90
CD="/Applications/Utilities/CocoaDialog.app/Contents/MacOS/CocoaDialog"
@krispayne
krispayne / macs-on-active-directory.md
Created October 8, 2015 00:55 — forked from bzerangue/macs-on-active-directory.md
Binding and Unbinding to Active Directory from Mac OS via Command Line

Binding and Unbinding to Active Directory from Mac OS via Command Line

  • Open the Terminal Application
  • Type in sudo -i and type in your Mac Administrator account password. sudo gives you root level or administrator level privileges.

To View current Active Directory Settings

dsconfigad -show

To Unbind a Computer from an Active Directory Domain

@krispayne
krispayne / addPrinter-hp.sh
Last active April 26, 2017 10:19
Bash script to deploy printer via JAMF Casper
#!/bin/bash
# Original: https://jamfnation.jamfsoftware.com/discussion.html?id=14467
# Useful script for deploying printers in a Casper Environment
# Originally by Lwindram on JAMF Nation forums
# https://jamfnation.jamfsoftware.com/viewProfile.html?userID=11026
# Edited to use JSS Script Parameters to make the script portable to all Models. Define $vars in JSS Policy.
## Translations
# man lpadmin
sudo scutil --set ComputerName "newname"
sudo scutil --set LocalHostName "newname"
sudo scutil --set HostName "newname"
#!/bin/sh
# Determines who is logged in and then kills SEP and relaunches sans reboot.
# Get logged in user from /dev/console
loggedInUser=`ls -l /dev/console | awk '{ print $3 }'`
if [ "$loggedInUser" != "admin" ]
then
launchctl unload /Library/LaunchDaemons/com.symantec.Sched501-1.plist

found on http://draac.com/chmodchart.html #CHMOD Chart CHMOD is used to change permissions of a file.

PERMISSION      COMMAND   
U   G   W
rwx rwx rwx     chmod 777 filename      
rwx rwx r-x     chmod 775 filename
rwx r-x r-x     chmod 755 filename
rw- rw- r-- chmod 664 filename

to enable: sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -activate -configure -access -on -users ADMIN_USER_HERE -privs -all -restart -agent -menu

to disable: sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -deactivate -configure -access -off

sudo /usr/sbin/jamf createAccount -username netadmin -realname "Network Administrator" -password "p@55w0rd" -home "/var/netadmin" -hiddenUser -admin -secureSSH