Not all entrepreneurs get to take their companies public. And even if they do, not all of them are prepared for what awaits them. I certainly was not prepared when I took my first startup company, Gupta Technologies, public in 1993. But I learned a lot from that early experience and applied the lessons to my next IPO in 1999. Fifteen years after happily running Keynote Systems as a public company, I recently sold it to a private equity company.

Here are five important lessons I learned during my two journeys from tech founder and entrepreneur to public company CEO:

1. “This is not your father’s company.” Those words were actually said to me, believe it or not, by an investment banker! Usually bankers are pretty diplomatic with their important CEO clients, but I’d obviously upset this very well-known industry figure with my brash ways. It was 1994 and the startup I had founded and run for nine successful years, Gupta Technologies, had gone public the previous year in one of the hottest tech IPOs of that era. But a year later, our fast growing client server tools and database business started to face increasing competition, leading us to miss a quarterly forecast. Well, that ended our 15 minutes of fame as a Wall Street darling, and our stock price dropped precipitously. Larry Ellison, my former boss from Oracle, called me up, and a few days later he offered to buy my company.

But I was just not ready to sell my baby. After all, it had my name on it, and I had built it brick by brick over many years.

What the banker was really saying to me then was that this was not my company any more, and while I was still its largest shareholder, it belonged to its public shareholders. It was not a company I had inherited from my dad, nor was I was going to pass it along to my children. I now had to think about what the majority of my shareholders would want me to do, not just what I as the founder wanted to do.

My board was divided about how to respond to the offer, but they mostly took their guidance from me. So when I said no to the offer, they went along. Big mistake. We should have sold the company for what in hindsight turned out to be a pretty good price. Even though I embarked on an ambitious turnaround plan, the stock continued to fall, the company’s position went from bad to worse, and 18 months later I finally threw in the towel. I resigned from position as CEO and from the board, sold all my shares, changed the name of the company, and went off to lick my wounds.

It was a hard lesson for a young entrepreneur. When you bring on the public as shareholders, you also lose some freedom of action as a CEO. As long as you are producing the numbers that Wall Street expects, you will have all the freedom you want. But if and when you miss your numbers, you need to keep Wall Street in mind as you create a plan to win back their favor. You can’t just ignore your shareholders as if they are simply suppliers of capital with no say-so in running their company. Which brings me to an elemental truth about tech companies so well known to most experienced investors.

2. “When a high tech company hits the wall, you don’t usually see the skid marks.” That’s a popular saying from Wall Street that is so very true. The overwhelming reason most investors invest in tech IPOs is because they expect higher growth from them than from more mature companies. Otherwise they would be just as comfortable investing in steel or railroads. So young, fast-growing Silicon Valley companies are often encouraged by their early venture capitalist investors to take advantage of an available “window of opportunity” to go public, even if they might not be ready for it.

Most such companies that go public have reached a point where their markets and business models are relatively proven, but that doesn’t mean they can achieve the earnings consistency of, say, a GE or IBM. In fact, some of them aren’t even making any earnings! And many have a large part of their revenues coming quite late in the quarter. So it’s only natural that some of them are likely to miss their forecasts, if not right after going public, then at least within the first few quarterly earnings cycles. But they are growing so fast, that when they do hit a revenue (or earnings) wall, even experienced CEOs sometimes don’t know it’s going to happen until the very end of the quarter. When they finally realize it’s time to hit the brakes, the accident’s already happened!

Despite the risk of such regular blow-ups, there are overwhelming benefits to most parties involved in the IPO process. The venture capitalists get to have a successful  financial exit, which results in increasing their fund returns. The entrepreneurs who founded the business find it incredibly seductive to take their company public and achieve not only a tangible net worth for their hard work but also get to be feted and celebrated by the public as heroes of our modern capitalist society. And, of course, the investment bankers make money on their commissions. Even the buyers of the IPO stock usually end up making money because the IPO price is usually established to result in a first day “pop” of the stock, which allows the major institutional buyers who purchase most of the scarce stock to make some quick returns.

Most everybody wins as long as the stock price does not crater during the usual lock-up period after the IPO because of an earnings miss or due to a general stock market meltdown. But what happens when the post-IPO honeymoon is over? That brings me to the most important job of the public company CEO.

3. “When CEOs have troubles at work, they take them home. When I have troubles, I usually sell them!” Those were the memorable words of a hedge fund investor who owned stock in my first company and also chose to invest in my second one. That second company was Keynote Systems, an Internet startup that I had the good luck to invest in as an angel investor in 1997 and whose founding shareholder I bought out a few months later to become its CEO.

While I was able to build a pretty solid business with real revenues and customers over the next two years, we also got lucky by timing our IPO with the Internet bubble of 1999 and raised a lot of money during a hot initial offering and an even hotter secondary offering a few months later. But once the bubble burst in early 2000 and most of our shareholders had sold their “troubles” in the stock market meltdown that followed, being an Internet company CEO was a lonely 24×7 job.

I took my troubles home every day. And unlike my investors, I could not just sell my company and move on to the next opportunity. There were no buyers for Keynote, and besides, most of the shareholders who had bought my stock at its post-bubble low point didn’t want me to sell out at the bottom. I figured that they had “re-hired” me to build more value into the company than what the stock market reflected at that time.

This understanding of the ultimate fiduciary duty of a public company CEO is what has guided my actions ever since. In any modern corporation, a CEO’s job is to act as a steward of shareholder capital. A public company CEO’s job is made harder because not all shareholders have the same investment time horizon, some want you to increase stock price in the short term regardless of long-term consequences, and others are more patient and understanding of a longer-term view. In other words, some are fickle and some are faithful. How then to reconcile the needs of this diverse owner base, and do so without twisting yourself or your employees into a constant state of churn similar to what exists in the stock market? That brings me to my next to last lesson.

4. “Love the one you’re with” – that’s an old song from the seventies. In this case it means, you can’t just flit from opportunity to opportunity without actually giving your full passion and energy and talent to the business that brought you to the IPO party. Operating a business day-in day-out can sometimes mean a lot of hard grinding work that requires you to constantly pay attention to boring details. Most startup entrepreneurs are great ideas people, but many reach a level of ineptitude when confronted with managing operating minutiae and processes. Some of them recognize this in themselves and step aside for a professional CEO or COO when their company arrives at such a stage. Others are forced to step aside before they go public by their venture capital investors if the company has moved out of the founder’s individual control. And yet, many companies do go public with their original founders at the helm.  Some of these founders evolve to become very capable public company CEOs, many do not.  While I was one of those founders who did not succeed at my first try, I was fortunate enough to have the opportunity to do it a second time, and apply the lessons I learnt from my first failure. Which brings me to my last lesson that does not need much elaboration.

5. “When the fat lady sings, exit stage left.”  However good your last act, there is always another act that follows. It is important to understand when your time on the stage is over, and to make room for the next act. Sometimes this means finding a successor to take the company to the next level without you,  sometimes it means selling the company to pursue an existence as part of a larger player, and sometimes it might mean taking it private to undertake a restructuring or strategy shift that is best done outside of the public eye.  The trick is to accomplish this with as much forethought as possible and above all—do it gracefully.  For the company, and for you !

[Read the companion piece to this story: Umang Gupta: 4 things I learned from a career in tech startups.]

Umang GuptaUmang Gupta is a well-known Silicon valley technology visionary, entrepreneur, company founder, and public company CEO. After having spent more than 40 years helping to build the enterprise software industry, among other things being credited with writing the first business plan for Oracle in 1981, Umang is now devoting his time exclusively to the fledgling online education industry as an investor, board member, and advisor.