views:

77

answers:

1

Hiya,

Problem background

I have a post-commit script for my SVN repository which archives & backs up the incremental dumpfiles when a checkin is made.

I'd like to update this to make an off-site backup, however the off-site copy could take a few minutes to complete if the checkin is large.

Question

Is it possible in a UNIX bash script to perform this copy in a thread that returns immediately, performing the action in the background?

Cheers for any help!

+3  A: 

nohup my-background-task &

The trailing & instructs bash to run it as a background job. The nohup command takes care of placing the task completely in the background: it tells it to ignore hangup signals (from the parent process closing), and it closes or redirects standard input and standard output if necessary (so that your background task won't hang around trying to keep your SSH window open, for example) .

Josh Kelley
Thanks for the answer and explanation. - I've just tested this out and it works a dream!
Nick Cartwright