This paper presents a periodic replacement policy for a system subject to shocks when the system is operating for a finite random horizon. The system is subject to shocks during operation, and each shock causes downgrading of the system performance and makes it more expensive to run by the additional running cost. Shocks arrive according to a nonhomogeneous or a renewal process, and we develop periodic replacement policies under a finite random operating horizon. The optimum periodic replacement interval which minimizes the total operating cost during the horizon is found. Numerical examples are presented to demonstrate the results.