A system is subject to shocks that arrive according to a nonhomogeneous Poisson process. As shocks occur a system has two types of failures. Type 1 failure (minor failure) is removed by a minimal repair, whereas type 2 failure (catastrophic failure) is removed by replacement. The probability of a type 2 failure is permitted to depend on the number of shocks since the last replacement. A system is replaced at the times of type 2 failure or at the nth type 1 failure, whichever comes first. The optimal policy is to select n* to minimize the expected cost per unit time for an infinite time span. A numerical example is given to illustrate the method. (C) 1996 John Wiley & Sons, Inc.