Re: Job scheduler

Jean-Paul Rehr <[email protected]>
Newsgroups gmane.text.xml.exist
Message-ID <CALcdGbyY9TvhvdiZO=ZStTTXg=ZuZkCiFB6xzgpGe62VDbQJRQ@mail.gmail.com>
Hi

Execution as "guest" is expected behaviour. Per
https://exist-db.org/exist/apps/doc/scheduler#job-author you need to switch
permissions or set the SetUid/SetGid bits on the XQuery file's permissions.

Authoring Jobs

The scheduler supports jobs that are authored in either XQuery or Java:
XQuery Jobs

Jobs coded in XQuery can be user type jobs only.

An XQuery job is a standard XQuery Main Module which is stored in the
database. You configure the scheduling of the job by providing the database
path to the XQuery, for example: /db/my-collection/my-job.xq.

XQuery job's are launched under the *guest* account. If you wish to perform
tasks as another user , either switch permissions by calling xmldb:login() from
within your job, or set the SetUid/SetGid bits on the XQuery file's
permissions (see Security <https://exist-db.org/exist/apps/doc/security> for
more information).
Cheers,
JPR


On Thu, Oct 12, 2023 at 1:52 PM Nicolas Souchon <
[email protected]> wrote:

> Dear All,
>
> I'm trying to schedule a job to run an XQuery function every day, but I'm
> encountering a problem that I don't know how to solve. According to the
> documentation, I've added the following lines to eXist-db/etc/conf.xml:
>
> <job type="user" xquery="/db/apps/myapp/myjob.xql" period="86400000"
> unschedule-on-exception="false">
> <parameter name="user" value="userName"/>
> <parameter name="password" value="userPassword"/>
> </job>
>
> With the XQuery attribute referring to my XQuery file (with a working
> XQuery function) and the parameters defining the username and password
> (which are also given in the XQuery file with xmldb:login()), but it
> doesn't work.
>
> It seems that there are problems with the user, as indicated by the
> scheduler.log file:
>
> 2023-10-12 13:31:45,491 [db.exist.scheduler.quartz-worker-3] INFO
>  (JobRunShell.java [run]:207) - Job eXist.User.XQuery:
> /db/apps/myapp/myjob.xql threw a JobExecutionException:
> org.quartz.JobExecutionException: UserXQueryJob Failed: Permission denied
> for the scheduling user: guest! Unscheduling UserXQueryJob.
> at org.exist.scheduler.UserXQueryJob.abort(UserXQueryJob.java:251)
> ~[exist-core-6.2.0.jar:6.2.0]
> at org.exist.scheduler.UserXQueryJob.abort(UserXQueryJob.java:247)
> ~[exist-core-6.2.0.jar:6.2.0]
> at org.exist.scheduler.UserXQueryJob.execute(UserXQueryJob.java:173)
> ~[exist-core-6.2.0.jar:6.2.0]
> at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
> ~[quartz-2.3.2.jar:?]
> at
> org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573)
> ~[quartz-2.3.2.jar:?]
>
> Can anyone tell me how to solve this? I don't understand why the scheduler
> is trying to run the function as Guest user.
>
> Best regards,
>
> Nicolas
> _______________________________________________
> Exist-open mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/exist-open
>

_______________________________________________
Exist-open mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/exist-open
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.