#!/bin/bash #------------------------------------------------------------------------------ # Copyright (c) Perforce Software, Inc., 2007-2014. All rights reserved # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # 1 Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL PERFORCE # SOFTWARE, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON # ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR # TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF # THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH # DAMAGE. #------------------------------------------------------------------------------ # # Use chkconfig --add p4web_REPL_INSTANCE_init to set up the script to start and stop automatically. # Perforce Web Init Script. # chkconfig: - 90 30 # description: Start Perforce web instance REPL_INSTANCE # Source config for p4web_REPL_INSTANCE instance source /p4/common/bin/p4_vars REPL_INSTANCE || exit 1 source /p4/common/bin/p4web_base $1
Fixed an environment insulation bug in init scripts.
More testing (and thinking) revealed that the only way to truly
provide a guarantee of insulation from user-set defaults in
~perforce/.bashrc (etc.) is to pass SDP_INSTANCE as a parameter to
the *_base scripts, so that the instance name is explicitly passed
into the su/exec call (when run as root).
This change also includes minor cleanup in init scripts and *_base
Fixed env bug seen when running init scripts as root.
Updated *_base scripts and *_init script templates to a new
1. Init scripts that use corresponding *_base scripts are
minimized so that do nothing more than set SDP_INSTANCE and
then call the corresponding *_base script.
2. The 'su' commands always pass $* instead of $1, deferring
all processing to the *_base script.
3. The shell environment is now guaranteeds to have the same
results regardless of whether it is called as 'root' or as
the defined OSUSER.
4. The p4_vars file is always sourced exactly once. Two
calls to 'source p4_vars' appear in some cases, one
immediatley before the su/exec call, and another after the
after the 'su/exec'. Only one or the other is sourced.
5. All init scripts have a reasonably consistent usage message.
6. All init scripts accept a 'status' argument.
This change fixes a bug where 'p4broker_N_init status' run as the
'perforce' user would report many pids unrelated to Perforce
if run as root, e.g. doing 'service p4broker_N_init status'.
This also eliminates a potential issue where the 'perforce'
user might source a p4_vars with a default instance in ~/.profile
or ~/.bashrc, thus invalidating the instance specified when the
user ran the init script as root.
Tweaked all init scripts to default to 'status' (rather than an ugly
syntax error) of the user forgets the start/stop/status parameter,
as was done previosly for the broker init script.
Removed unnecessary 'source' call when calling p4<whateve>_base scripts.
Cleaned up comments.
Routine merge to dev from main using:
p4 merge -b perforce_software-sdp-dev
|#3||13914||tom_tyler||Applied SDP_INSTANCE to templates.|
Initial work to simplify p4_vars and remove cluster stuff.
Testing of named instances surfaced some bugs that are in prod sdp,
now fixed in dev.
Added three triggers from RCJ SDP
Moved p4review.cfg into the new /p4/common/cfg to go along with the
instance_vars files. mkdirs.sh now generates an instance_p4review.cfg
Removed incremental p4verify to clean up a bit. It didn't support replicas
and was really never used.
All port settings now live in <instance>_vars file. You set what you want
the ports to be in mkdirs.sh. There is no more fancy logic to try to guess
what the port should be. You set it, and that is what it is.
Remaining to do is to updated scripts to not need p4master_run. Saved
that work for later since this is tested and works.
|#1||10148||tom_tyler||Promoted the Perforce Server Deployment Package to The Workshop.|