You are here: Home » Topic » Timed scanning…

Timed scanning…

This topic contains 16 replies, has 6 voices, and was last updated by  Dave.B 10 years, 9 months ago.

Viewing 15 posts - 1 through 15 (of 17 total)
  • Author
    Posts
  • #812

    Dave.B
    Participant

    Just a thought, inspired by me fiddling with my virus scanner scheduler and my backup software scheduler:

    Instead of supplying just a rescan interval on the config page, would it be hard to change it so that you can have more options controlling exactly when it scans?

    For example, I would like to be able to tell Firefly to rescan my database once every day, at 4 am. That way I will never see it scan, and any new music will automatically get added. At the moment my rescan interval is 0 because scans seemed to be conflicting with normal operation a while ago (that could be fxed now – I don’t know).

    I realise I can almost do this already by setting the scan interval to 86400 seconds, and “Always scan” to “Yes”, but to get it to scan at 4am, presumably I would need to make the change to the config file at that time? I don’t do 4 am for anyone!

    Good idea/bad idea?

    #7495

    fizze
    Participant

    well, ron somewhen suggested that a wget to a certain URL would trigger a rescan…

    ah, there you go:
    http://forums.fireflymediaserver.org/viewtopic.php?t=3779&highlight=rescan+wget

    donno if that would still work, given its been a while…..

    #7496

    rpedde
    Participant

    @fizze wrote:

    well, ron somewhen suggested that a wget to a certain URL would trigger a rescan…

    ah, there you go:
    http://forums.fireflymediaserver.org/viewtopic.php?t=3779&highlight=rescan+wget

    donno if that would still work, given its been a while…..

    .. and with a wget for win32, a batch file and windows scheduled tasks, that would work.

    Might be worth a helper app or something though for the poor windows users that don’t have a scriptable operating system…

    #7497

    fizze
    Participant

    …well thats all there for windoze 😉

    http://users.ugent.be/~bpuype/wget/
    and the script would be one^h^h^h two lines:


    @echo off
    wget "http://user:[email protected]:port/config-update.html?action=rescan"

    then schedule that script, and voila.
    if you’re on a mac you got cron anyway. 🙂

    #7498

    sonichouse
    Participant

    On XP you can do the following

    at 04:00 pathtowget http://user:[email protected]:port/config-update.html?action=rescan

    This will run at 4:00 AM every day

    #7499

    Dave.B
    Participant

    Wow, I never knew about that “at” command – cheers, it will probably come in very handy.
    Anyway, I’m running Firefly on a slug, so I’d want to run a script on that. And as I have no idea how to write a script for Linux, let alone run it at specified times, it means that I’ve got to go away and do some reading – I’ll probably figure it out eventually, but in terms of use-ability for Linux novices (like me), I reckon this (small?) enhancement to the web-config page could be worthwhile.

    Just an idea. Whether it gets added or not, keep up the good work. Firefly is a great piece of software that is appreciated every single day in my home. 😀

    #7500

    fizze
    Participant

    haha, well if you run it on the slug its even easier 🙂

    ipkg install cron

    although im not even sure thats neccesary.

    then edit your crontab with your fave editor, or just use

    crontab -e 

    (crontab normalyl sits in /etc/crontab or so) which will invoke vi and will probably leave you puzzled *g* 😀

    so a new line in crontab like this

    5 0 * * * /opt/bin/wget http://user:[email protected]:port/config-update.html?action=rescan

    should do the trick, if you want to run the rescan every day at 05:00 (am)

    #7501

    Dave.B
    Participant

    Thanks fizze, I’ll have a bit of a play…

    #7502

    Dave.B
    Participant

    OK, I realise this was ages ago now, but I was just having a bit of a play with this. I found http://en.wikipedia.org/wiki/Cron
    In the example fizze gave me above, shouldn’t the 5 and the 0 swap places? i.e

    0 5 * * * /opt/bin/wget http://user:[email protected]:port/config-update.html?action=rescan

    Surely in fizze’s example it scans at 5 minutes past midnight, every day, month etc… In what I’ve put above, (I think) it scans at 0 minutes past 5, every day, month etc… Similar effects, but I’m often up long past midnight.
    Am I right? I want to make sure before I go fiddling with stuff I only half understand.
    Cheers
    Dave

    #7503

    [email protected]
    Participant

    You’re right 😉

    #7504

    Dave.B
    Participant

    Thanks [email protected] for the sanity check.
    I suspect Fizze was only trying to catch me out so that I did some reading around, and it worked.
    I’ve verified that the command part works, so I’ll go ahead and add the line to /etc/crontab

    While I’m here: what’s the difference between adding it to:
    /etc/crontab ;
    and adding it to:
    /opt/etc/crontab?
    Does the former run at user level (root) and the latter at system level? If so, which is preferable? And why?

    #7505

    mas
    Participant

    /etc is where the crond looks that comes with unslung automatically. Yes you dont have to do an ipkd install cron.

    if you install that cron extra it should look in /opt/etc/ though.

    Look at the other entries in the crontab. The crontab entries should actually also have an extra field for the username it shall run as!

    #7506

    Dave.B
    Participant

    Mas,
    That probably explains why Firefly was not responding this morning. I assume the command ran at 5am this morning, but without the user field it got a bit stuck.
    I’ll restart when I get home and fix that.
    There are 3 other commands in my crontab file – they all run as root so I take it this one should too?

    #7507

    fizze
    Participant

    no!
    they should run as the user that is specified in mt-daapd.conf file, the user mt-daapd runs as.

    #7508

    Dave.B
    Participant

    Fizze, when you say “they”, do you mean the lines already there, which I haven’t changed in any way, or do you mean new lines that I add?

    If the latter, then…

    0 5 * * * guest /opt/bin/wget http://user:[email protected]:port/config-update.html?action=rescan

    would seemingly do the job, right?

Viewing 15 posts - 1 through 15 (of 17 total)

You must be logged in to reply to this topic.