Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to restart CACHE(database that I am using) Instance from shell script. What I did is created a function in the shell script named resatrt_cache.

 ccontrol stop instancename restart

This command is running but the control goes to cache and while stopping cache it get stuck to this question

**Do you want to broadcast a message to anyone? No =>**

How can I pass the value here through shell script

share|improve this question

On the assumption that it takes input from stdin, and you want to answer "no":

restart_cache() {
    ccontrol stop instancename restart << EOF

Note: the indentation is important.

If you want to answer "no" to any and all prompts, you can use yes instead:

restart_cache() {
    yes no | ccontrol stop instancename restart

If you'd rather accept the defaults (and the program takes a line feed to mean that), use yes ''.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.