Question: I have a compression command which I pipe to a md5sum check command as such:

```
   tar zcvpf file.tar.gz file | xargs -I '{}' bash -c "test -f '{}' && md5sum '{}'" | tee file_mybackup.md5

```

I would now like to split the tar.gz file into 100MB chunks. I can do this by:

```
   tar zcvpf - file | split -d -b 1M - file.tar.gz.

```

Is there a way that I can pipe the output of the tar command to simultaneously perform the split command and md5sum check? I know that split does not output to STDOUT so I can't pipe from the split command to the md5sum command.
I tried to use a named pipe:

```
    mkfifo newpipe

    tar zcvpf - file | tee newpipe | split -d -b 1M - file.tar.gz. &

    cat newpipe | xargs -I '{}' bash -c "test -f '{}' && md5sum '{}'" | tee file_mybackup.md5

```

However this fails to output the md5sum output. Any help would be appreciated

Answer: 
If the background task is assigned to a specific user, you could use session data to indicate that task has completed. In your Ajax function, you could look at this session data, and only look at the database when you have indication that this is completed:

<https://docs.djangoproject.com/en/1.8/topics/http/sessions/>

Another solution would be to use a system file, used for synchronization. For example:

* The file is created when the background task is created, with start date and time. You may add further information like the user that requested it.
* As long as the file is present (With a further check for timeout, checking the data from the file), no need to look at the database.
* If the file is not present, you know that the request has completed and you can look at the database to update.

This file may also be accessible as an Url (To avoid the Ajax request)
Maybe you should use Jquery and ajax to do the request using this..

<http://api.jquery.com/category/deferred-object/>

Hope it helps you