loading basex from a cron job

Monday, 11 February 2013 · 11 messages · last reply 13 Feb 2013
JE
Jens Eratin reply to rsr, 11 Feb 2013, 13:5511 Feb 2013 12:59 #
Is there any error message in your syslog files? How does the line in the crontab look like?
-- Jens Erat [phone]: tel:+49-151-56961126 [mail]: mailto:email at jenserat.de [jabber]: xmpp:jabber at jenserat.de [web]: http://www.jenserat.de PGP: 350E D9B6 9ADC 2DED F5F2 8549 CBC2 613C D745 722B
Quoted text · rsr · 10 lines
Am 11.02.2013 um 12:55 schrieb rsr <robt.s.ryan at gmail.com>: > I am just getting started with basex and have been attempting to load data into a basex db via a cron job. I am running the basexclient inside my job redirecting a bxs command file to the client. this works well when i run my script off the command line by fails when run via cron. i've checked the obvious stuff (relative paths, permissions etc). > > Does anyone have experience loading basex via cron that could point me in the right direction. thanks > > /home/xxx/basex/bin/basexclient -Uxxx -Pxxx < /home/xxx/load.bxs > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
AA
Andria Arisalin reply to rsr, 11 Feb 2013, 14:0511 Feb 2013 13:14 #
Hi Robt, I don't know if you can use sequence of commands on crontab, while I would use "/home/xxx/basexjob.sh" instead of "cd home/xxx; ./basexjob.sh" That's is respond from looking your cron line. hope it helps, -andria
Quoted text · rsr · 18 lines
On Mon, Feb 11, 2013 at 1:05 PM, rsr <robt.s.ryan at gmail.com> wrote: > no error in syslog > > 40 * * * * cd home/xxx; ./basexjob.sh > > > > On 02/11/2013 06:59 AM, Jens Erat wrote: > >> Is there any error message in your syslog files? How does the line in the >> crontab look like? >> >> > ______________________________**_________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-**konstanz.de <BaseX-Talk at mailman.uni-konstanz.de> > https://mailman.uni-konstanz.**de/mailman/listinfo/basex-talk<https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk> >
JE
Jens Eratin reply to rsr, 11 Feb 2013, 14:0511 Feb 2013 13:18 #
Hi!
Quoted text · rsr · 1 line
> 40 * * * * cd home/xxx; ./basexjob.sh
- Which user's crontab is that line in, the user's you've been testing the script from? - home/xxx looks weird, do you probably mean /home/xxx? - What's inside your basexjob.sh? - - - On Andria's comments:
Quoted text · rsr · 1 line
> I don't know if you can use sequence of commands on crontab
That's fine.
Quoted text · rsr · 1 line
> while I would use "/home/xxx/basexjob.sh" instead of "cd home/xxx; ./basexjob.sh"
The script could depend on the current path. If it doesn't, I'd prefer that, too. Regards form Lake Constance, Germany, Jens
-- Jens Erat [phone]: tel:+49-151-56961126 [mail]: mailto:email at jenserat.de [jabber]: xmpp:jabber at jenserat.de [web]: http://www.jenserat.de PGP: 350E D9B6 9ADC 2DED F5F2 8549 CBC2 613C D745 722B
Quoted text · rsr · 14 lines
Am 11.02.2013 um 13:05 schrieb rsr <robt.s.ryan at gmail.com>: > no error in syslog > > 40 * * * * cd home/xxx; ./basexjob.sh > > > On 02/11/2013 06:59 AM, Jens Erat wrote: >> Is there any error message in your syslog files? How does the line in the crontab look like? >> > > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
R
rsr11 Feb 2013 13:55 #
I am just getting started with basex and have been attempting to load data into a basex db via a cron job. I am running the basexclient inside my job redirecting a bxs command file to the client. this works well when i run my script off the command line by fails when run via cron. i've checked the obvious stuff (relative paths, permissions etc). Does anyone have experience loading basex via cron that could point me in the right direction. thanks /home/xxx/basex/bin/basexclient -Uxxx -Pxxx < /home/xxx/load.bxs
JE
Jens Eratin reply to rsr, 11 Feb 2013, 14:4411 Feb 2013 13:56 #
Has the misspelled path been in your crontab or only your mail? Is it working now? You didn't reply on this line:
Quoted text · rsr · 1 line
> - Which user's crontab is that line in, the user's you've been testing the script from?
-- Jens Erat [phone]: tel:+49-151-56961126 [mail]: mailto:email at jenserat.de [jabber]: xmpp:jabber at jenserat.de [web]: http://www.jenserat.de PGP: 350E D9B6 9ADC 2DED F5F2 8549 CBC2 613C D745 722B
Quoted text · rsr · 38 lines
Am 11.02.2013 um 13:44 schrieb rsr <robt.s.ryan at gmail.com>: > thanks for the replys > > 1 - its ok to stack multiple commands in cron, i do it all the time > 2 - yes, i miskeyed my cron line is should be "40 * * * * cd /home/xxx; ./basexjob.sh" > 3 - line in my bash script is "/home/xxx/basex/bin/basexclient -Uxxx -Pxxx < /home/xxx/load.bxs" > > > > > > > On 02/11/2013 07:18 AM, Jens Erat wrote: >> Hi! >> >>> 40 * * * * cd home/xxx; ./basexjob.sh >> - Which user's crontab is that line in, the user's you've been testing the script from? >> - `home/xxx` looks weird, do you probably mean `/home/xxx`? >> - What's inside your `basexjob.sh`? >> >> - - - >> >> On Andria's comments: >> >>> I don't know if you can use sequence of commands on crontab >> That's fine. >> >>> while I would use "/home/xxx/basexjob.sh" instead of "cd home/xxx; ./basexjob.sh" >> The script could depend on the current path. If it doesn't, I'd prefer that, too. >> >> Regards form Lake Constance, Germany, >> Jens >> > > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
R
rsrin reply to Jens Erat, 11 Feb 2013, 12:5911 Feb 2013 14:05 #
no error in syslog 40 * * * * cd home/xxx; ./basexjob.sh
Quoted text · Jens Erat · 3 lines
On 02/11/2013 06:59 AM, Jens Erat wrote: > Is there any error message in your syslog files? How does the line in the crontab look like? >
JE
Jens Eratin reply to robt ryan, 11 Feb 2013, 15:0111 Feb 2013 14:09 #
Please answer my question on which user's crontab used. This is important as BaseX by default accesses its configuration files and data in the user's home directory, so if you're testing that script using user "xxx" but use "root"s crontab, you're writing to another home directory. If so, either move to "xxx"s crontab (probably best way) or append some `sudo -u xxx ` either in your script or when calling it.
-- Jens Erat [phone]: tel:+49-151-56961126 [mail]: mailto:email at jenserat.de [jabber]: xmpp:jabber at jenserat.de [web]: http://www.jenserat.de PGP: 350E D9B6 9ADC 2DED F5F2 8549 CBC2 613C D745 722B
Quoted text · robt ryan · 70 lines
Am 11.02.2013 um 14:01 schrieb robt ryan <robt.s.ryan at gmail.com>: > The cron job definition has been fine all along; the bash script fires fine as well, but the referenced line , below, in the script that runs the basexclient does not seem to be running. > > > > On Mon, Feb 11, 2013 at 7:56 AM, Jens Erat <jens.erat at uni-konstanz.de> wrote: > Has the misspelled path been in your crontab or only your mail? Is it working now? > > You didn't reply on this line: > > > - Which user's crontab is that line in, the user's you've been testing the script from? > > > -- > Jens Erat > > [phone]: tel:+49-151-56961126 > [mail]: mailto:email at jenserat.de > [jabber]: xmpp:jabber at jenserat.de > [web]: http://www.jenserat.de > > PGP: 350E D9B6 9ADC 2DED F5F2 8549 CBC2 613C D745 722B > > > > Am 11.02.2013 um 13:44 schrieb rsr <robt.s.ryan at gmail.com>: > > > thanks for the replys > > > > 1 - its ok to stack multiple commands in cron, i do it all the time > > 2 - yes, i miskeyed my cron line is should be "40 * * * * cd /home/xxx; ./basexjob.sh" > > 3 - line in my bash script is "/home/xxx/basex/bin/basexclient -Uxxx -Pxxx < /home/xxx/load.bxs" > > > > > > > > > > > > > > On 02/11/2013 07:18 AM, Jens Erat wrote: > >> Hi! > >> > >>> 40 * * * * cd home/xxx; ./basexjob.sh > >> - Which user's crontab is that line in, the user's you've been testing the script from? > >> - `home/xxx` looks weird, do you probably mean `/home/xxx`? > >> - What's inside your `basexjob.sh`? > >> > >> - - - > >> > >> On Andria's comments: > >> > >>> I don't know if you can use sequence of commands on crontab > >> That's fine. > >> > >>> while I would use "/home/xxx/basexjob.sh" instead of "cd home/xxx; ./basexjob.sh" > >> The script could depend on the current path. If it doesn't, I'd prefer that, too. > >> > >> Regards form Lake Constance, Germany, > >> Jens > >> > > > > _______________________________________________ > > BaseX-Talk mailing list > > BaseX-Talk at mailman.uni-konstanz.de > > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk > > > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
R
rsrin reply to Jens Erat, 11 Feb 2013, 13:1811 Feb 2013 14:44 #
thanks for the replys 1 - its ok to stack multiple commands in cron, i do it all the time 2 - yes, i miskeyed my cron line is should be "40 * * * * cd /home/xxx; ./basexjob.sh" 3 - line in my bash script is "/home/xxx/basex/bin/basexclient -Uxxx -Pxxx < /home/xxx/load.bxs"
Quoted text · Jens Erat · 21 lines
On 02/11/2013 07:18 AM, Jens Erat wrote: > Hi! > >> 40 * * * * cd home/xxx; ./basexjob.sh > - Which user's crontab is that line in, the user's you've been testing the script from? > - `home/xxx` looks weird, do you probably mean `/home/xxx`? > - What's inside your `basexjob.sh`? > > - - - > > On Andria's comments: > >> I don't know if you can use sequence of commands on crontab > That's fine. > >> while I would use "/home/xxx/basexjob.sh" instead of "cd home/xxx; ./basexjob.sh" > The script could depend on the current path. If it doesn't, I'd prefer that, too. > > Regards form Lake Constance, Germany, > Jens >
RR
robt ryanin reply to Jens Erat, 11 Feb 2013, 13:5611 Feb 2013 15:01 #
The cron job definition has been fine all along; the bash script fires fine as well, but the referenced line , below, in the script that runs the basexclient does not seem to be running. On Mon, Feb 11, 2013 at 7:56 AM, Jens Erat <jens.erat at uni-konstanz.de>wrote:
Quoted text · Jens Erat · 67 lines
> Has the misspelled path been in your crontab or only your mail? Is it > working now? > > You didn't reply on this line: > > > - Which user's crontab is that line in, the user's you've been testing > the script from? > > > -- > Jens Erat > > [phone]: tel:+49-151-56961126 > [mail]: mailto:email at jenserat.de > [jabber]: xmpp:jabber at jenserat.de > [web]: http://www.jenserat.de > > PGP: 350E D9B6 9ADC 2DED F5F2 8549 CBC2 613C D745 722B > > > > Am 11.02.2013 um 13:44 schrieb rsr <robt.s.ryan at gmail.com>: > > > thanks for the replys > > > > 1 - its ok to stack multiple commands in cron, i do it all the time > > 2 - yes, i miskeyed my cron line is should be "40 * * * * cd /home/xxx; > ./basexjob.sh" > > 3 - line in my bash script is "/home/xxx/basex/bin/basexclient -Uxxx > -Pxxx < /home/xxx/load.bxs" > > > > > > > > > > > > > > On 02/11/2013 07:18 AM, Jens Erat wrote: > >> Hi! > >> > >>> 40 * * * * cd home/xxx; ./basexjob.sh > >> - Which user's crontab is that line in, the user's you've been testing > the script from? > >> - `home/xxx` looks weird, do you probably mean `/home/xxx`? > >> - What's inside your `basexjob.sh`? > >> > >> - - - > >> > >> On Andria's comments: > >> > >>> I don't know if you can use sequence of commands on crontab > >> That's fine. > >> > >>> while I would use "/home/xxx/basexjob.sh" instead of "cd home/xxx; > ./basexjob.sh" > >> The script could depend on the current path. If it doesn't, I'd prefer > that, too. > >> > >> Regards form Lake Constance, Germany, > >> Jens > >> > > > > _______________________________________________ > > BaseX-Talk mailing list > > BaseX-Talk at mailman.uni-konstanz.de > > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk > >
R
rsrin reply to Jens Erat, 11 Feb 2013, 14:0912 Feb 2013 04:17 #
There is something in the basexclient script that causes it to fail despite my best attempts to coax it to run in a contrived cron environment. Cron job has been running all along as "xxx" user. I finally just gave up on the script and and am simply running the client out of my cron script by directly invoking the jvm myself i.e.
java -cp ......... org.basex.BaseXCLient
Its not the prettiest thing I have ever done, but its working.
Quoted text · Jens Erat · 7 lines
On 02/11/2013 08:09 AM, Jens Erat wrote: > Please answer my question on which user's crontab used. > > This is important as BaseX by default accesses its configuration files and data in the user's home directory, so if you're testing that script using user "xxx" but use "root"s crontab, you're writing to another home directory. > > If so, either move to "xxx"s crontab (probably best way) or append some `sudo -u xxx ` either in your script or when calling it. >
CG
Christian Grünin reply to rsr, 11 Feb 2013, 14:4413 Feb 2013 13:34 #
Dear Rob, in general, BaseX runs fine when being invoked via cronjobs. Next, I just reproduced your scenario and didn’t encounter any surprises (I have no idea, though, what‘s happening inside your script).
Quoted text · rsr · 1 line
> 3 - line in my bash script is "/home/xxx/basex/bin/basexclient -Uxxx
-Pxxx <
Quoted text · rsr · 1 line
> /home/xxx/load.bxs"
You may need to remove the last "<", as there is no need to redirect the file contents to the client: /home/xxx/basex/bin/basexclient -Uxxx -Pxxx /home/xxx/load.bxs Hope this helps, Christian
Quoted text · Jens Erat · 34 lines
> On 02/11/2013 07:18 AM, Jens Erat wrote: >> >> Hi! >> >>> 40 * * * * cd home/xxx; ./basexjob.sh >> >> - Which user's crontab is that line in, the user's you've been testing the >> script from? >> - `home/xxx` looks weird, do you probably mean `/home/xxx`? >> - What's inside your `basexjob.sh`? >> >> - - - >> >> On Andria's comments: >> >>> I don't know if you can use sequence of commands on crontab >> >> That's fine. >> >>> while I would use "/home/xxx/basexjob.sh" instead of "cd home/xxx; >>> ./basexjob.sh" >> >> The script could depend on the current path. If it doesn't, I'd prefer >> that, too. >> >> Regards form Lake Constance, Germany, >> Jens >> > > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk

⚡Generated with XQuery