View Single Post
  #1 (permalink)  
Old 04-07-2009, 12:53 PM
raj's Avatar
raj raj is offline
Senior Member
User
 
Join Date: Jun 2005
Location: Hyderabad
OS: Fedora, Debian Linux
Posts: 307
Thanks: 42
Thanked 8 Times in 8 Posts
Rep Power: 6
raj will become famous soon enough raj will become famous soon enough
Default Config Parameter Expansion - How does it works?

if I add postfix_enable:="YES" in /etc/rc.conf postfix service starts on boot. However, if I don't it will not start on boot. This is easy to understand, but /usr/local/etc/rc.d/postfix startup script has small parameter expansion
Code:
: ${postfix_enable:="NO"}
How does it works? How this small code tells script whether postfix_enable set to YES or not in /etc/rc.conf file? Why : used before ${postfix_enable:="NO"}? Here is sample script:
Code:
. /etc/rc.subr

name="postfix"
rcvar=${name}_enable

load_rc_config $name

: ${postfix_enable:="NO"}
: ${postfix_pidfile:="/var/spool/postfix/pid/master.pid"}
: ${postfix_procname:="/usr/local/libexec/postfix/master"}
: ${postfix_flags:=""}

start_cmd=${name}_start
stop_cmd=${name}_stop
extra_commands="reload"

pidfile=${postfix_pidfile}
procname=${postfix_procname}

postfix_start() {
        /usr/local/sbin/postfix ${postfix_flags} start
}

postfix_stop() {
        /usr/local/sbin/postfix ${postfix_flags} stop
}

run_rc_command "$1"
__________________
Raj
Linux rulz.
I have never turned back in my life ; I shall not do so today.. haha
Reply With Quote