January 5, 201313 yr I sometimes miss having the option to find files on command line with the locate command. The binary is part of findutils, but it's not packaged with Unraid by default, so I created a slackware package for it and knocked up an installation script. Thought I'd share it here in case someone else finds it useful. The main thing to remember is that locate relies on a database which is maintained using the updatedb command and is typically scheduled to run via cron. The installation script creates a cron entry set to run daily at 3am. I figure those happy to use this will know enough to change that to suit their needs. Also, updatedb can be configured to ignore files, paths and filesystems. These are also configurable from the installation script. For instance, I have set mine to ignore /mnt/user eg. user shares, as otherwise I'd get duplicate entries for files. ie one for /mnt/user and one for /mnt/diskx where the file physically resides. The script is pretty self-explanatory and it should be obvious what needs to be changed. Script is attached to this message. The findutils package is too big to attach, so here's a link to it from my dropbox; https://dl.dropbox.com/u/572553/UnRAID/findutils/findutils-4.4.2-i486-1rj.tgz I've tested it on a couple of unraid systems including my main system and it seems to index everything correctly. However, usual caveats apply! NB. this is not a plugin and the install script does not make any attempt to download the package in the link above. It assumes you have already put a copy in /boot/packages. Basic steps to get this working; 1. download package from link above and put into /boot/packages (or /flash/packages if accessing flash drive over a share) 2. save copy of attached install_locate.sh.txt to somewhere permanent. eg. mine is in /boot/scripts. Make sure it has execute permissions. (it should by default if you've saved to your flash drive). Ideally strip off the .txt extension too. 3. edit install_locate.sh to suit your needs. Specifically make sure you're happy with LOCATE_PATH. This is the path and filename of the database. 4. run the install script. 5. check cron entry has been created. eg. crontab -l from command line 6. type updatedb. this will perform a find across your drives and create the initial database. 7. test by trying to find a file. eg. locate somefileiknowexists Regards, overbyrn PS. if anyone knows of a web front-end that can read the database file, please let me know! install_locate.sh.txt
May 19, 20179 yr I have this:http://mirrors.slackware.com/slackware/slackware64-14.2/slackware64/a/slocate-3.1-x86_64-4.txz and these user scripts using User Scripts plugin # slocateInitialize @ Array startup #!/bin/bash cat << EOF > /etc/updatedb.conf # /etc/updatedb.conf: slocate configuration file PRUNEFS="devpts NFS nfs afs proc smbfs autofs iso9660 udf tmpfs cifs" PRUNEPATHS="/dev /proc /sys /tmp /usr/tmp /var/tmp /afs /net /media /var/lib/docker /mnt/user0 /mnt/user /boot" export PRUNEFS export PRUNEPATHS EOF [ -f /mnt/user/appdata/slocate/slocate.db ] && cp -p /mnt/user/appdata/slocate/slocate.db /var/lib/slocate/slocate.db # slocateBackup @Custom "0 6 * * *" #!/bin/bash cp -vp /var/lib/slocate/slocate.db /mnt/user/appdata/slocate/slocate.db What these extra scripts do is tell slocate where to search (and where not to search) after the plugin is installed and to backup the search database daily @ 6am local time. (about 1hr after the default run of slocate cronjob at 4am (AFAIK that's what it is on my system) Edited May 19, 20179 yr by ken-ji corrected link
Archived
This topic is now archived and is closed to further replies.