I\'m writing a backup script which
You want fsync (man section 2) function call, but if you're doing this in a script, you'll probably want to use the sync command (man section 8), which just calls sync().