There are two criteria for right livelihood. First, it should not be necessary to break the five precepts in one's work, since doing so obviously causes harm to others. But further, one should not do anything that encourages other people to break the precepts, since this will also cause harm. Neither directly nor indirectly should our means of livelihood involve injury to other beings. Thus any livelihood that requires killing, whether of human beings or of animals, is clearly not right livelihood.... Selling liquor or other drugs may be very profitable, but even if one abstains from them oneself, the act of selling encourages others to use intoxicants and thereby to harm themselves. Operating a gambling casino may be very lucrative, but all who come there to gamble cause themselves harm. Selling poisons or weapons--arms, ammunition, bombs, missiles--is good business, but it injures the peace and harmony of multitudes. None of these is right livelihood.- S. N. Goenka, The Art of Living
Even though a type of work may not actually harm others, if it is performed with the intention that others should be harmed, it is not right livelihood. The doctor who hopes for an epidemic and the trader who hopes for a famine are not practicing right livelihood.
From Everyday Mind
So to live right it is not enough just to live right by yourself, it is equally important to live life so that others can live right. But who are these "others"?
May the force be with you