Where to put my backup.sh?
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.
Solution 1:
Some people install additional stuff in /usr/local others in /opt.
See: http://www.pathname.com/fhs/
Solution 2:
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.