Web Hosting Talk







View Full Version : Simple unix/linux question, I guess


BonsaiRack
10-22-2008, 05:05 PM
I have a long rsync command, that I didnt want to type each time.
So I made an executable called "syncback" and put it in my /bin folder.
Now, when I type syncback at prompt, the rsync command execute itself perfectly.
I want to perfect this command a bit more to do the following:
Execute itself in background, so when I execute the commande at prompt, a message says "Rsync running in background" and im immediatly taken back to prompt.
Second, I want the result of this command to email itself to a specific email adress, much like my cron is doing when executing a command.
Any idea how I should do so ?

rghf
10-22-2008, 05:11 PM
You could do something like the following. Have synback be
rsync -a ..... | mail user@domain.com
And run synback as "nohup syncback " which puts it into the background. Maybe also "syncback &" which will run it as a job under the bash shell you are on
A cleaner solution might be using screen to spawn a session or similar if you want to monitor it