Restarting a local/remote computer on the console terminal mac os

Restarting a Computer
To restart a computer at a specific time, use the reboot or shutdown -r command. For more information, see their man pages.
To restart the local computer:
$ shutdown -r now
To restart a remote computer immediately:
$ ssh -l root computer shutdown -r now To restart a remote computer at a specific time:
$ ssh -l root computer shutdown -r hhmm

Shutting Down a Computer
To shut down a computer at a specific time, use the shutdown tool. For more information, see the shutdown man page.
To shut down a remote computer immediately:
$ ssh -l root computer shutdown -h now To shut down the local computer in 30 minutes:
$ shutdown -h +30

http://developer.apple.com/documentation/Darwin/Reference/ManPages/

Property Lists(plists) to specify attributes, proerties of an application or process on mac osx

Editing Property Lists
Many preference and configuration files in Mac OS X use property lists (plists) to specify the attributes, or properties, of an application or process. An example is the Finder’s preferences plist in the Library/Preferences/ folder of a user’s home folder. The file is named com.apple.Finder.plist. The default naming convention for a plist includes the distributor’s reverse DNS name prepended to the application or process name, followed by a“.plist” extension.
Property lists are binary files that you can edit using the following tools:
    Property List Editor is a graphical application that’s a part of the Xcode developer tools. You can get the Xcode tools from developer.apple.com. Property List Editor is most useful if you already understand property lists and their conventions.
 PlistBuddyPlistBuddy is a command-line tool for directly reading and modifying values inside a property list without the need to convert the property list to an intermediary format.
 defaults is a command-line tool that you can use to edit property lists.
The defaults command is a powerful tool, with functionality beyond simple editing of property lists. When you know the specific key and value in a property list that you need to change, it’s very efficient.

A plutil is a command-line tool that you can use to change a property list into a format you can edit with a text editor, and then change back to its binary format.
Using PlistBuddy to edit property lists
The PlistBuddy command is designed to easily read and modify values in a property list. If you know the values to set or read, you can quickly make changes with PlistBuddy. PlistBuddy works on specific property list files.
This example shows how to use the PlistBuddy command interactively to change the orientation of the Dock for a local user:
1    Determine the names of the appropriate property list, key, and values. In this case, the name for the Dock’s property list is com.apple.Dock.plist. If you were editing the Dock property list for the user alecjones, the path would be:
/Users/raza/Library/Preferences/com.apple.Dock.plist 2    Enter in the following command to enter the PlistBuddy interactive mode:
PlistBuddy /Users/raza/Library/Preferences/com.apple.Dock.plist If the path to PlistBuddy isn’t in your default paths, you need to add it or explicitly
call it as follows:
/usr/libexec/PlistBuddy ~/Library/Preferences/com.apple.Dock.plist
See “Executing Commands and Running Tools” on page 13.
If the file you’re trying to edit doesn’t exist, PlistBuddy creates the file in the designated location.
3    In interactive mode, you can choose from many commands. To set or change the orientation of the Dock to the left side of the screen, enter:
Set :orientation left
4    Save and exit: Save
Exit PlistBuddy can also be run non-interactively. To make the same change without
invoking interactive mode:
/usr/libexec/PlistBuddy -c « Set :orientation left » ~/Library/Preferences/ com.apple.Dock.plist
Both examples above assume the orientation key already exists. This isn’t necessarily true for a new user in Mac OS X version 10.6. Don’t assume that a value exists. First, confirm it with the Print command. Otherwise, you need to use the Add command, which also requires designating a type.

There are many other options for PlistBuddy that are invoked in a similar manner. For information about PlistBuddy, see its man page.
Using the defaults command to edit property lists
The defaults tools works directly with the Mac OS X preferences subsystem and is used by many applications in Mac OS X to manage preferences and other settings. It can be built into shell scripts and allows you to access preferences in the multiple domains that exist on a given computer.
Determine the names of the appropriate property list, key, and values. For example, the name for the Dock’s property list is com.apple.Dock.plist. (When invoking the defaults command, omit the .plist extension.)
Using the values you have determined or been given, enter their values following the defaults command:
defaults write com.apple.dock orientation left
In most cases, you need to restart the application or process. A simple way to do this is to use Activity Monitor to select the appropriate process, and then click Quit Process. For this example, you would choose the process named Dock.
For information about defaults, see its man page.
Using plutil and a text editor to edit property lists
In Mac OS X v10.6, plist files are stored in a binary format. If you want to edit them with a text editor, you must first convert them to plain text. To convert a plist file to plain text, use the plutil command:
plutil -convert xml1 com.apple.dock.plist
This results in an XML text file that you can edit. When you’re done, convert the file back to binary format:
plutil -convert binary1 com.apple.dock.plist Before making any changes to plist files using plutil, make a backup copy of the files.
Do this in the Finder, or use the cp command: cp com.apple.finder.plist com.apple.dock.plist.bak

Sample cron (crontab -e) task on unix mac osx

SHELL=/bin/sh PATH=/bin:/sbin:/usr/bin:/usr/sbin

HOME=/var/log #min hour mday month wday command

30 18 * * 1-5 diskutil repairPermissions /Volumes/MacHD

50 23 * * 0 diskutil repairVolume /Volumes/MacHD

Monitoring mechanisms on mac osx services launchd(see launchctl, service)

Monitoring and Restarting Critical Services with launchd
Mac OS X includes a system for monitoring and running critical service, which you may want to use to run various shell scripts. This system is uses a daemon named launchd. During system startup, launchd is the first process the kernel runs to set up the computer. In Mac OS X Server, your daemon should be started by launchd. Other mechanisms for starting daemons and services are subject to removal at Apple’s discretion.
You can get an idea of the various processes run by launchd by looking at the following configuration files:
Folder
Usage
/System/Library/LaunchDaemons/
/System/Library/LaunchAgents/
/Library/LaunchDaemons/
/Library/LaunchAgents/
~/Library/LaunchAgents/
Apple-supplied system daemons
Apple-supplied agents that apply to all users on a per-user basis
Third-party system daemons
Third-party agents that apply to all users on a per-user basis
Third-party agents that apply to the logged-in user only
You do not interact with launchd directly—instead you use launchctl to load or unload launchd daemons and agents.

Note: In earlier versions of Mac OS X and Mac OS X Server, system administrators used the watchdog daemon to monitor critical services or modified the rc scripts. These are no longer supported and should be replaced with calls using launchd.
In earlier versions of Mac OS X and Mac OS X Server, system administrators used the watchdog daemon to monitor critical services or modified the rc scripts. These are no longer supported and should be replaced with calls using launchd.
For more information about launchd, see the launchd and launchctl man pages. Also see Technical Note TN2083: Daemons and Agents on the Apple Developer Connection.

Sample for  start a service with launchctl:
$ launchctl load -w /System/Library/LaunchDaemons/tftp.plist

//to stop the process tftp
$launchctl unload -w /System/Library/LaunchDaemons/tftp.plist

Sample for service:
$sudo service tftp start
$sudo service tftp stop
$sudo service –list

Create vlan interface on mac osx

On the terminal console, you should follow thoses commands:

//To create the vlan interface, the number is not related to the vlan tag.

$sudo ifconfig vlan0 create

//To associate the vlan0 interface to the physical en0 interface and to tag the vlan traffic with tag 50.

$sudo ifconfig vlan0 vlan 50 vlandev en0

//To assign a static IP-address to the vlan0 interface.

$ ifconfig vlan0 inet 1.2.3.4 netmask 255.255.255.0

// To assign a dynamic dhcp ip address on the vlan0:

$ ifconfig set vlan0 DHCP

//If needed, use the route gateway default:

$ route add default 192.168.0.1

//To delete/destroy the vlan interface:

$ifconfig vlan0 destroy

From the interface window, choose the gui from your system preference, gui network and the virtual interface on the mechanic option.

So, your mac is available to use vlan(802.1q).