Changeset 14481 for trunk/base
- Timestamp:
- Oct 8, 2005, 7:01:54 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/base/src/port1.0/portstartupitem.tcl
r14480 r14481 2 2 # portstartupitem.tcl 3 3 # 4 # $Id: portstartupitem.tcl,v 1.1 5 2005/10/08 18:42:21jberry Exp $4 # $Id: portstartupitem.tcl,v 1.16 2005/10/08 19:01:54 jberry Exp $ 5 5 # 6 6 # Copyright (c) 2004, 2005 Markus W. Weissman <mww@opendarwin.org>, … … 43 43 # 44 44 # startupitem.pidfile none 45 # -There is no pidfile we can track45 # There is no pidfile we can track 46 46 # 47 47 # startupitem.pidfile auto [filename.pid] 48 48 # The daemon is responsible for creating/deleting the pidfile 49 # - We can use this to try to detect if the process is already running50 # - We can use this to try to ensure that the process has stopped51 49 # 52 50 # startupitem.pidfile cleanup [filename.pid] 53 51 # The daemon creates the pidfile, but we must delete it 54 # - We can use this to try to detect if the process is already running55 52 # 56 53 # startupitem.pidfile manual [filename.pid] … … 59 56 # startupitem.logfile logpath 60 57 # Log to the specified file -- if not specified then output to /dev/null 61 # - for launchd, just set this as the key58 # - for launchd, just set this as the standard out key 62 59 # - for systemstarter, redirect to this 63 60 # … … 65 62 # Log events to the log 66 63 # - for launchd, generate log messages inside daemondo 67 # - for systemstarter, generate log messages in script64 # - for systemstarter, generate log messages in our generated script 68 65 # 69 66 … … 120 117 121 118 proc startupitem_create_darwin_systemstarter {args} { 122 global prefix destroot portname os.platform119 global prefix destroot destroot.keepdirs portname os.platform 123 120 global startupitem.name startupitem.requires startupitem.init 124 global startupitem.start startupitem.stop startupitem.restart 125 global startupitem.executable 121 global startupitem.start startupitem.stop startupitem.restart startupitem.executable 126 122 global startupitem.pidfile startupitem.logfile startupitem.logevents 127 123 … … 186 182 if { ![llength ${startupitem.requires} ] } { 187 183 set startupitem.requires [list Disks NFS] 184 } 185 if { ![llength ${startupitem.logfile} ] } { 186 set startupitem.logfile "/dev/null" 188 187 } 189 188 … … 372 371 373 372 proc startupitem_create_darwin_launchd {args} { 374 global prefix destroot portname os.platform373 global prefix destroot destroot.keepdirs portname os.platform 375 374 global startupitem.name startupitem.requires startupitem.init 376 global startupitem.start startupitem.stop startupitem.restart 377 global startupitem.executable 375 global startupitem.start startupitem.stop startupitem.restart startupitem.executable 378 376 global startupitem.pidfile startupitem.logfile startupitem.logevents 379 377 … … 497 495 # If pidfile was specified, translate it for daemondo. 498 496 # 499 # There are three cases: 500 # (1) auto pidfilename 501 # (2) cleanup pidfilename 502 # (3) manual pidfilename 497 # There are four cases: 498 # (1) none 499 # (2) auto [pidfilename] 500 # (3) cleanup [pidfilename] 501 # (4) manual [pidfilename] 503 502 # 504 503 set pidfileArgCnt [llength ${startupitem.pidfile}] 505 if { ${pidfileArgCnt} } { 504 if { ${pidfileArgCnt} > 0 } { 505 if { $pidfileArgCnt == 1 } { 506 set pidFile "${prefix}/var/run/${itemname}.pid" 507 lappend destroot.keepdirs "${destroot}${prefix}/var/run" 508 } else { 509 set pidFile [lindex ${startupitem.pidfile} 1] 510 } 511 506 512 if { ${pidfileArgCnt} != 2 } { 507 513 ui_error "$UI_PREFIX [msgcat::mc "Invalid parameter count to startupitem.pidfile: 2 expected, %d found" ${pidfileArgCnt}]" 508 } else {509 # Translate into appropriate arguments to daemondo510 set pidStyle [lindex ${startupitem.pidfile} 0]511 set pidPath [lindex ${startupitem.pidfile} 1]512 513 auto { lappend args "--pid=fileauto" "--pidfile" ${pidPath}}514 clean { lappend args "--pid=fileclean" "--pidfile" ${pidPath} }515 manual { lappend args "--pid=exec" "--pidfile" ${pidPath} }516 default {517 ui_error "$UI_PREFIX [msgcat::mc "Unknown pidfile style %s presented to startupitem.pidfile" ${pidStyle}]"518 }514 } 515 516 # Translate into appropriate arguments to daemondo 517 set pidStyle [lindex ${startupitem.pidfile} 0] 518 switch ${pidStyle} { 519 none { lappend args "--pid=none" } 520 auto { lappend args "--pid=fileauto" "--pidfile" ${pidFile} } 521 clean { lappend args "--pid=fileclean" "--pidfile" ${pidFile} } 522 manual { lappend args "--pid=exec" "--pidfile" ${pidFile} } 523 default { 524 ui_error "$UI_PREFIX [msgcat::mc "Unknown pidfile style %s presented to startupitem.pidfile" ${pidStyle}]" 519 525 } 520 526 }
Note: See TracChangeset
for help on using the changeset viewer.