Run a regular command as a daemon?

michaelsanford

Translator, Web Developer
This might be a bit of a silly question, but how do I run a regular command-line tool as a daemon?

My reason: I want to use CURL or FTP to download a huge file from a remote server, onto another remote server. I can't be reliably connected (to my terminal) for the entire duration of the download, so if it gets to 99% and my terminal connection dies, so does the shell that's running curl or ftp, and bye bye download.

Do I need to write my own command-line tool to do this, or can I just su to root and run the command backgrounded with & ?

(I was sure there was a post about this somewhere but I couldn't find it...)
 
My situation might not be entirely clear (lots of coffee today while programming, a bit jittery :p).

I am at 1's console, logging into 2 remotely over SSH, downloading a file from 3 onto 2 with curl or ftp.

1 --- 2 --- 3

The files are 3 800MB disk images (legal free downloads) from slow mirrors capped at 25-30kbps. If you can think of a better way to do this I'm all ears! :D
 
Depending on if it is available look into starting your process with 'nohup' as that will make it ignore when your process when it goes away. If you want to come bask to it you want a program called 'screen' which will run on the remote host when you log in you can connect to it and reattach to a previously running session.

-Eric
 
Back
Top