Where is the best place to store custom scripts for ease of maintenace?
-
I am running pfSense on a machine with an SSD (not embedded), and I want to set up a couple of small python or shell scripts that run from CRON. Where is the best place to store these scripts for ease of backup, and so they survive upgrades and other automated maintenace tasks?
-
Where ever you want is fine. Upgrades won't change files that don't exist in the base system.
-
May be good idea to avoid /tmp and /var. Depending on type of install and ram disk settings they could evaporate when system is rebooted.
I put stuff like that in /vvar.
-
May be good idea to avoid /tmp and /var. Depending on type of install and ram disk settings they could evaporate when system is rebooted.
I put stuff like that in /vvar.
What about backup? If I understand correctly, backup only backs up config.
Would be nice to be able to roll everything into the backup, but maybe that's not possible.
Having custom files in the middle of the existing system sounds like a maintenance/backup nightmare.Would I be better off to create a user (custom) and put everything in /home/custom ?
At least everything is in one spot. -
I just create a folder on / like /custom. Then any scripts that are called in cron are easily recognizable since the work custom is right in the command line.
-
Personally, I keep custom files under /root/ so they're easy to keep track of. Really though, as cmb said, it doesn't matter so long as you know where they are. You can use the "Backup" package to backup arbitrary files and directories.
If you want to follow hier(7) for your scripts, then common programs and utilities go in /usr/local/bin/ and administrator and system daemons/utilities would go in /usr/local/sbin/
-
If I had to choose I would use /root instead /usr/local, the latter is reserved for ports and packages that are under pkg control.
-
@kpa:
If I had to choose I would use /root instead /usr/local, the latter is reserved for ports and packages that are under pkg control.
Files from packages may reside there but it isn't solely for them. In FreeBSD it's for anything, as the name implies, local. As in non-base-system. It's free to be used in that way. See the link in my previous reply.
-
Or you can go all the way with additional partition mounted anywhere you like. Only thing to remember - not to select "Quick install" on full reinstall.
-
Thanks everyone for the input everyone… You've helped me think this over... and given:
-
I want/need ease of maintenance-simple backup/restore.
-
Custom scripts with least privilege possible-under an user with minimal rights.
-
It's only a couple of scripts and a few kb of disk space. (A partition is not warranted.)
-
/root is not completely under user control… file backup plugin uses it.
I'm thinking that it would be hard to do better than:
-
creating a user: custom (with minimal rights).
-
Stick everything in /home/custom
-
Write a quick script to tar.gz /home/custom and scp to my FreeNAS box for backup
(or maybe use the file backup plugin, but given that it doesn't do time versions
automatically or allow granular restore or multiple backup profiles.)
A normal configuration restore will recreate everything except the actual scripts in /home/custom
If I'm missing something or anyone has any other suggestions, be glad to hear them.
-