Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm writing a shell script that will make backups of my system ( like this: ).

What is the best location in my system, to store this file? I know, I can put it anywhere, but what will be if it will be stored in a directory being backed up? What is the best practice here?

I'm running an Ubuntu-server.

share|improve this question
up vote 4 down vote accepted

Some people install additional stuff in /usr/local others in /opt.


share|improve this answer

As others have said, under /usr/local/ , not /opt/. I usually also have these sorts of scripts in /root/ , but that can be considered bad practice. One possibility is also /etc/cron.daily/ .

But you really should be asking yourself why you are doing this. Homegrown backup scripts are easier to get wrong than some off-the-shelf backup solution. And remember, you don't want backups, you want working restores.

share|improve this answer
+1 I agree with you that you should have a restoration plan rather than a backup plan. I would add that I want to backup my application settings, emails, files, databases, localhost web sites, databases, cron jobs, list of installed packages and some various configuration files for eruby, fstab etc. I found the easiest way was to write my own script to back up all of this but only this in a way I can just pull as restore from. Off the shelf backup utilities are difficult to configure to my exact requirements. – Richard Holloway Mar 15 '10 at 22:34
Well, I'm planning to back up my /var/www catalog (web sites) and do a database dump. So, restoration plan is simple: take a website copy from archive and restore from database dump. Why is it bad idea to write custom script? Or did I misunderstood your thought? – Temnovit Mar 16 '10 at 10:45
I don't think it is a bad idea. I think it is a good idea to roll your own. What ptman is suggesting is that you may make a mistake in your code. This is no reason not to do it though – Richard Holloway Mar 18 '10 at 11:38

I have a separate user account on my home machine for tasks like backups, anti virus scans etc.

Jobs like go in that home directory. The advantage of doing this is that it is easy then to backup without having to back up all of /usr/ to catch a few bespoke scripts.

On servers /usr/local/sbin/ for system binaries or /usr/local/bin/ for other scripts is fairly standard.

/opt/ can be used but is usually for third party applications.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.