title: kill and restart the application from shell script
body: <p>I am trying to invoke the script from the c code, wherein the script file kills the application and restarts</p>
  <pre><code>/* testApp.c */
  int main()
  {
      int data;
      printf(&quot;Enter the data\n&quot;);
      scanf(&quot;%d&quot;,&amp;data);
      
      /* Invoke the script file */
      system(&quot;script.sh&quot;);
  
  }
  </code></pre>
  <p>and below is the script file</p>
  <pre><code>#!/bin/sh
  
  pkill testApp
  
  start-stop-daemon --start  --user root --name testApp --startas testApp -- --daemon
  pidof testApp
  if [ $? == 0 ]
  then
      echo &quot;Restart of testApp success!!&quot; 
  else
      echo &quot;Restart of testApp failed!!&quot;
      exit 1  
  fi
  
  exit 0
  </code></pre>
  <p>when the application is executed, it terminates the running process and restarts the application, but it is not waiting at scanf for user input, just continues to execute
  why isn't the application waiting for user input, if invoked from script file</p>