New York Office
70-11 Austin Street, Suite 3L
Forest Hills, NY 11375
Tel : (866) 228-6286
Fax : (718) 897-9665
Florida Office
13899 Biscayne Blvd
Suite 211 Miami, FL 33181
Tel : (866) 228-6286
Fax : (718) 897-9665
Las Vegas Office
1810 E. Sahara Ave.
Las Vegas, NV 89104 suite #121
Tel : (866) 228-6286
Fax : (718) 897-9665

Reboot Computer Services inc. Solution Experts

  • Increase font size
  • Default font size
  • Decrease font size
Hints

Adding a Prefix to all files in a folder

In my sample folder I have 5 text files that I would like to add a prefix to the file name.
First you change directory to where my folder is located. In my example is a folder called "Folder" at the root of my hard drive.
Then I run a "For in" loop to read all file in the directory.
for FILE in * ; do mv $FILE Reboot_$FILE ; done

Here is our end result. You can modify the prefix to almost anything.
 

Find and delete matching files

Lets day for some reason you needed to find files that were more than 30 minutes old and delete those files. You can use a very simple command for this that you can later add to an Apple script, shell script or even automate it using Launchd.
This will find and remove any files in the folder path specified in quotes that is older than 30 minutes
find "folder path"  -type f -mmin +30 -exec rm {} \;
You can also modify this and search for things that are older than 7 days
find "folder path" -type f -mtime +7 -exec rm {} \;
 

Create a hidden admin account

For many reason you may want to create a hidden admin account in your system. This account will be hidden from the System Preferences, Login Window, Fast user switching menu and the home folder will not be in /Users. It will be very difficult for a user to know that his account exists. This is an interactive script so it requires you to enter the desire user name and password.
To create the configuration script, copy the text below beginning with the line "#Begin Copy" to the line "#End Copy" and paste the text into TextEdit. Before you save the file go to the "Format" and select "Make Plain Text".
Create Hidden User
### Begin Copy ###
#!/bin/sh
echo Please Enter the Username you want to create
read USERNAME
echo Please Type in the password
oldmodes=`stty -g`
stty -echo
read PASSWORD
stty $oldmodes
sudo dscl . create /Users/$USERNAME
sudo dscl . create /Users/$USERNAME PrimaryGroupID 80
sudo dscl . create /Users/$USERNAME NFSHomeDirectory /private/var/$USERNAME
sudo dscl . create /Users/$USERNAME UniqueID 499
sudo dscl . create /Users/$USERNAME UserShell /bin/bash
sudo dscl . passwd /Users/$USERNAME $PASSWORD
sudo dscl . append /Groups/admin GroupMembership $USERNAME
sudo defaults write /Library/Preferences/com.apple.loginwindow Hide500Users -bool TRUE
sudo defaults write /Library/Preferences/com.apple.loginwindow HiddenUsersList -array $USERNAME
sudo defaults write /Library/Preferences/com.apple.loginwindow SHOWOTHERUSERS_MANAGED -bool FALSE
sudo createhomedir -c -u $USERNAME
sudo SetFile -a V /private/var/$USERNAME
### End Copy ###
You save the file and name it createhiddenuser.sh. Now open the Terminal application and type
"sudo sh " and the path to the script file. You can also drag the createhiddenuser.sh on to the terminal window and it will enter the path for you.
It will ask you to enter the Desired user name and password. Your done.
 

Get your Public IP via Terminal

Getting your public IP could be very helpful. Using a browser you can go to a site like www.whatismyip.com, but If you need to get it from the terminal it's a little different. Open the Terminal Application and enter the following command;
curl -s www.whatismyip.com/automation/n09230945.asp

or

curl -s checkip.dyndns.org|sed -e 's/.*Current IP Address: //' -e 's/<.*$//'
 

Teired Software Update Server

Problem: You have 10 software update servers that you only allow certains updates to be download by the clients. If you setup all the server individually, every time a new update comes out it will downloaded from Apple's master Software Update Server and you will have to enable that update on all 10 servers. Here is how you can have 1 internal master and other slave servers in a way that if you enable update on the Master and all the slave servers will mirror that.

1. On the Master SUS: ServerAdmin -> Server's Name -> Software Update -> Settings, you will select "Copy All updates from Apple" but uncheck "Automatically enable copied updates"

2. On the Master SUS: ServerAdmin -> Servername -> Software Update -> Updates, here you will select the approved Updates you want to provide to the slave server and ultimately your clients.

 

 

3. On the Slave SUS: First we need to backup the configuration file located at /etc/swupd/swupd.plist file. You can do this in the Terminal application by entering the following command:

sudo cp /etc/swupd/swupd.plist /etc/swupd/swupd.plist.bak


4. One the Slave SUS: Now we can modify the file using the Terminal application by using the following command:

sudo /usr/libexec/PlistBuddy -c 'set metaIndexURL http://Internal_Master.com:8088/catalogs.sucatalog' /etc/swupd/swupd.plist

Please make sure you replace "Internal_Master.com" with your Master's FQDN or IP address.


5. On the Slave SUS: ServerAdmin -> Server's Name -> Software Update -> Settings, you will select "Copy All updates from Apple", "Automatically enable copied updates" and "Delete outdated software updates.

* This will look at the Master and only download the ones you have enabled on the Master. By selecting "Delete outdated software" it will let you remove an update from the slave by simply unchecking it from the Master.


 

 
  • «
  •  Start 
  •  Prev 
  •  1 
  •  2 
  •  3 
  •  4 
  •  Next 
  •  End 
  • »


Page 1 of 4