How to scrap industrial machinery?

In the case of passenger cars, once they are no longer economically viable, there is no problem as to what to do with them. They are scrapped, dismantling the more valuable parts if possible, in order to make at least some funds for the disposal of the vehicle. But what if a similar problem arises with industrial machinery? How do you dispose of production lines in compliance with occupational health and safety rules?