Once you daemonize it, you lose control of it. You'll have to control it some other way than keypresses. You could have some other program which sends a signal to the daemon process on control-s, perhaps.
Could you give me a simple example to understand what you mean exactly?
Is it better instead of running it as a daemon then to just run it with the while loop and stop it with the signal control-s?But in that case I would need an echo command and if the user doesn't press the control-s then it would wait instead of go on..
I can't really give you a simple example of something that can't work the way you want it to...
I have no idea what you'd need an echo for, or why it'd need to wait for anything.
The easiest thing to do would be to just loop, and wait for the user to do ctrl-C, sigint. Then you could just let that break the loop, or trap it and change some variable. If it must be ctrl-s, you could do finicky things with stty to redefine ctrl-s as ctrl-c for the same effect.
corona is right - instead of showing how you decided to do it, pretend you are just telling us what you are trying to do, and have no clue how to accomplish your task.
Aside from the fact that what you wrote is not a true daemon. And. It still has a process group with a controlling terminal. Among other issues.