I'm newer to bash/cgi scripts, and could certainly use a hand with what I'm trying to do. I have a home server, and want to allow client computers to issue commands to it. I've done this successfully through cgi scripts.
However, what I'm trying to do now, is take these scripts and send a process to the background, so to speak. For instance, initiating a backup, and then printing something to the user immediately. Instead, right now, it won't go the next line of code until the current process is finished.
Here's an example. Again, I'm newer to this, so I know it might be a bit of a hack job. If there's a more efficient way to code this, I'm all ears:
Code:
#!/bin/sh
printf "Content-Type: text/html"
echo
echo
echo "<HTML>"
echo "<HEAD>"
echo "</HEAD>"
echo "<BODY>"
echo "Dummy Text"
cp -a /foo /bar &
echo "working..."
echo "</BODY>"
echo "</HTML>"
It seemed like putting the & at the end of the cp line would throw it to the background, but it still won't go to the next line of code until the cp command is finished. Suggestions?