Welcome to the navigation

Dolor fugiat dolor eu aute duis irure cupidatat laborum, voluptate non excepteur in mollit commodo veniam, elit, pariatur, sit et occaecat ut quis ut est. Et minim magna aliqua, dolor nulla proident, tempor eu ut fugiat consectetur quis sunt occaecat excepteur amet, ea lorem ullamco voluptate ad reprehenderit cillum culpa

Yeah, this will be replaced... But please enjoy the search!

Restart all running services in OS X Server

Categories Tags
In some Linux distributions it's possible to restart all running services by typing
$/sbin/services.sh restart
This guide will help you to create an equivalent command in OS X Server. This should work on pretty much any OS X server version, but I have only tested it in Leopard Server and Snow Leopard Server.

First things first

Start by creating the script, I prefer nano but pretty much any text editor will do
$nano ~/Documents/serviceRestart
Paste this text into the script
# /bin/sh
echo "--- Script start ---"

# Create the array
services=( $(sudo serveradmin list) )

# Make the masterloop
for eachService in ${services[@]}; do

  # Check the status of the current service listed in the array
  tc=$(sudo serveradmin status $eachService | grep -io "RUNNING")

  # If the service is running, then restart it, we wont touch other services
  if [ "$tc" = "RUNNING" ]; then
    echo $i $eachService "(RUNNING)"
    sudo serveradmin stop $eachService && sudo serveradmin start $eachService

echo "--- Script end ---"
# /bin/sh
"--- Script start ---"
dd execute rights to the script
$sudo chmod +x ~/Documents/serviceRestart
And link the script into /usr/bin for easy execution
$sudo ln -s ~/Documents/serviceRestart /usr/bin/

Running the script

Open the terminal and enter
The sudo command inside the script might ask for your password. This is normal. Good luck!
Please note that this portal is a BETA site , I will continuously improve all functionality and performance during the coming weeks / the author