In this paper we consider a repairable production unit subject to random failures, which supplies input to a subsequent assembly line operating according to a just-in-time configuration. Preventive maintenance actions are regularly performed on the production unit at instants T,2T,3T,… The corrective and preventive mainenance actions have random durations. In order to palliate perturbations caused by breakdowns and by planned maintenance actions, a buffer stock is built up to ensure the continuous supply of the assembly line at a constant rate β. To build up this buffer stock, the production unit produces at a rate α+β. The proposed strategy consists in building up, at the beginning of each preventive maintenance cycle, a buffer stock whose size ‘S’ covers at least the average consumption during the repair periods following breakdowns within the period of length T. At the instant T when the production unit has to be stopped to undertake the planned preventive maintenance actions, a certain level of buffer stock must still be available in order to avoid stoppage of the subsequent assembly line. A mathematical model has been developed for this strategy. It takes into account the probability distributions associated to lifetime, repair time, preventive maintenance duration, as well as the renewal process associated to the operation–repair cycles of the production unit. The optimum values of the decision variables ‘S’ and ‘T’ are obtained by trading off the maintenance cost, the inventory holding cost, and the shortage cost such as their sum is minimum.