0

The Scenario

I'm automating backups via a bash script. The script is executed via cron. The script archives directories recursively using tar, and then rsync's them to the remote host. Here is a sample:

...
for PATH in $DIRS
do
    ...
    tar -cpvzf $FFILE $PATH --exclude-from /tmp/excludes
    ...
    rsync -az --partial --rsync-path="sudo rsync" $FFILE mybackupserver:$REMOTEFILES
    ...
done
...

Each time tar or rsync is invoked, a new process (and therefore PID) is spawned for each one, obviously.

My Question

If I kill the process that started the script, will the child tar and rsync processes also be killed off immediately? Or will they run until completion, and no further ones will be spawned thereafter?

I'm reluctant to interrupt the tar or rsync processes mid-stream.

Thanks.

Jongosi
  • 163

1 Answers1

1

They will become orphan processes, becoming children of the script's parent. Usually they will become descendants of init.

Isaac
  • 261