Assume that terminals of several companies are not far apart. Each company provides transportation and storage of goods. If a terminal of some company is crowded, then the company can rent a storage space in a terminal of another company. If a terminal of some company is not loaded, then a part of the premises may be leased to another company. Rental of the terminal to another company and the transportation of goods from one terminal to another require additional costs. It is desirable to anticipate the need for the rental of the premises of another company, as the organization of rent and transportation of goods require some additional time and financial resources. Therefore, long-term planning of financial resources is necessary in order to provide additional costs. Cargo flow is stochastic in nature and is not fully known in advance. In this paper, we consider the problem of scheduling of a job of a terminal in a simplified mathematical model. The dynamics of the boot process of the terminal is determined by the stochastic equation with control. A general approaches to the problem of optimal control with the purpose to ensure acceptable conditions for the functioning of the terminal are formulated. For a number of practically important cases the problems of the optimal control are solved. Bibliogr. 12.