6

I'm writing a shell script that will make backups of my system ( like this: https://help.ubuntu.com/8.04/serverguide/C/backup-shellscripts.html ).

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.

1

3 Answers 3

4

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

See: http://www.pathname.com/fhs/

7

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.

3
  • +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. Mar 15, 2010 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, 2010 at 10:45
  • 1
    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 Mar 18, 2010 at 11:38
3

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

Jobs like backup.sh 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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .