Generally speaking, preventive repair is a routine checkup that enhances system reliability. Minor and major repairs shut down the production unit for a random time. During the maintenance period, a buffer inventory is essential to minimise the economic loss. Moreover, the production system may enter an out-of-control state after a certain time that follows a probability density function. The probability of defective items being produced is smaller in the in-control state than in the out-of-control state. In this paper, these defective items are immediately reworked at a cost in a parallel system. To attract customers, a warranty period is provided. It is quite rational that the probability of failure rate of defective items is greater than the probability of failure rate of conforming items within the warranty period. Therefore, this paper considers that A2 ¼ R0w h2ðÞd is greater than A1 ¼ R0w h1ðÞd. In this paper, the optimal buffer inventory (S*) and optimal production run time (T*) are obtained by minimising the unit production cost (ETCU), considering the inventory costs for the buffer, the shortage cost, the rework cost, the setup cost, the material cost, the labour/energy costs, the cost of the minimal repair warranty and maintenance costs. The elegance of the model is that the global minimum value of ETCU is analysed for general distribution functions f() and (t). Also, the model is illustrated by a suitable numerical example that satisfies all the necessary and sufficient conditions for a global minimum of the unit production cost (ETCU).