Mac OS X中/etc/rc.common的默认内容是什么?

时间:2017-08-17 15:09:59

标签: macos

我正在使用Mac OS Sierra(10.12.5)

有一个意外操作覆盖了我的/etc/rc.common文件的内容。

我可以知道从哪里获取此文件的默认内容?

(如果有人可以分享内容,那将会有所帮助)

1 个答案:

答案 0 :(得分:2)

来自我的10.12.5系统的rc.common。我很惊讶它没有受到SIP的保护:

##
# Common setup for startup scripts.
##
# Copyright 1998-2002 Apple Computer, Inc.
##

#######################
# Configure the shell #
#######################

##
# Be strict
##
#set -e
set -u

##
# Set command search path
##
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/libexec:/System/Library/CoreServices; export PATH

##
# Set the terminal mode
##
#if [ -x /usr/bin/tset ] && [ -f /usr/share/misc/termcap ]; then
#    TERM=$(tset - -Q); export TERM
#fi

####################
# Useful functions #
####################

##
# Determine if the network is up by looking for any non-loopback
# internet network interfaces.
##
CheckForNetwork()
{
    local test

    if [ -z "${NETWORKUP:=}" ]; then
    test=$(ifconfig -a inet 2>/dev/null | sed -n -e '/127.0.0.1/d' -e '/0.0.0.0/d' -e '/inet/p' | wc -l)
    if [ "${test}" -gt 0 ]; then
        NETWORKUP="-YES-"
    else
        NETWORKUP="-NO-"
    fi
    fi
}

alias ConsoleMessage=echo

##
# Process management
##
GetPID ()
{
    local program="$1"
    local pidfile="${PIDFILE:=/var/run/${program}.pid}"
    local     pid=""

    if [ -f "${pidfile}" ]; then
    pid=$(head -1 "${pidfile}")
    if ! kill -0 "${pid}" 2> /dev/null; then
        echo "Bad pid file $pidfile; deleting."
        pid=""
        rm -f "${pidfile}"
    fi
    fi

    if [ -n "${pid}" ]; then
    echo "${pid}"
    return 0
    else
    return 1
    fi
}

##
# Generic action handler
##
RunService ()
{
    case $1 in 
      start  ) StartService   ;;
      stop   ) StopService    ;;
      restart) RestartService ;;
      *      ) echo "$0: unknown argument: $1";;
    esac
}