Coder Social home page Coder Social logo

Comments (6)

jcurl avatar jcurl commented on June 14, 2024 1

I just came across this to try and debug why my tests weren't working (I need to trigger a job immediately after an upload to post-process data). Then I changed the logging to DEBUG and noticed that it takes a long time before the cron is run (hour or so?).

As a workaround, is there a hint where in the sources I might be able to workaround this to trigger immediately? I'm not a PHP dev (but do develop in C for embedded), so some guidance would be appreciated.

As in the original request, it could be useful if there's a description how to trigger this from the command line (so I can put in my own cronjob).

from workflow_script.

blizzz avatar blizzz commented on June 14, 2024

Then I changed the logging to DEBUG and noticed that it takes a long time before the cron is run (hour or so?).

please see https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/background_jobs_configuration.html

from workflow_script.

blizzz avatar blizzz commented on June 14, 2024

For testing it would be great if one could trigger it from within the web interface.

You still need to force an event as configured to happen. Assumed it is there, hypothetically we can show a button to run an enqueued job perhaps. Alas it should be decoupled from the web request process for it might get in trouble on timeouts.

Alternatively it should be documented how to do through a terminal (=> call cron.php)

That's fair and probably best to achieve as you likely be on the system anyway when setting up this flow/script.

from workflow_script.

jcurl avatar jcurl commented on June 14, 2024

Thanks for the pointer to the server docs, I did find them too, and it does help them being here.

I've playing around how to get this to work. I set up the background jobs using 'cron' with systemd. It runs, and I can now see my scripts run (the md5sum is generated) also by setting the logging to DEBUG in the config file. Are there any limitations to what can be done in the script? The output of the script is next to the original file, and so it appears in the Files tab, I want to trigger "occ" to scan for files (works when done manually on the commandline), but for some reason, this doesn't appear to have any effect in the script itself.

e.g.

#
# Usage from NextCloud:
#  /opt/scripts/md5sum.sh %a %n

NEXTCLOUDDATA=/var/www/nextcloud/data
if [ ! -d $NEXTCLOUDDATA/$1 ]; then
        echo "USER $1 not found. Aborting" >> /tmp/mdlog.txt
        exit 1;
fi

if [ ! -f $NEXTCLOUDDATA/$2 ]; then
        echo "PATH $2 not found. Aborting" >> /tmp/mdlog.txt
        ls -l $NEXTCLOUDDATA >> /tmp/mdlog.txt
        ls -l $NEXTCLOUDDATA/$2 >> /tmp/mdlog.txt
        exit 1;
fi
echo "USER $1 PATH $2 execution" >> /tmp/mdlog.txt

INPUTFILE=$NEXTCLOUDDATA/$2
md5sum $INPUTFILE > $INPUTFILE.md5sum.txt
echo "Running Script Update" >> /tmp/mdlog.txt
ls -l $INPUTFILE* >> /tmp/mdlog.txt

/usr/bin/php -f /var/www/nextcloud/occ files:scan $1 >> /tmp/mdlog.txt
echo "DONE" >> /tmp/mdlog.txt

I don't see the "DONE" in the output (but everything else before the call to PHP). The newly generated file is not shown so it doesn't look like occ files:scan $1 (user) worked.

Really appreciate your pointers.

from workflow_script.

blizzz avatar blizzz commented on June 14, 2024

Works for me. Perhaps scanning takes too long for you?

You can only scan the new file, instead of everything, that should speed up things.

# ...
RELFILE="$2.md5sum.txt"
/usr/bin/php -f /srv/http/nextcloud/master/occ files:scan -p "$RELFILE" -- $1 >> /tmp/mdlog.txt
# ...

from workflow_script.

blizzz avatar blizzz commented on June 14, 2024

As there is no feedback since a while I will close this ticket. If this is still happening please feel free to reopen.

from workflow_script.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.