Project

General

Profile

How to start l2cpbg via the Task Scheduler

Added by Markus Jessl over 3 years ago

Hello Joerg,

I'm currently trying to run l2cpbg under a Windows 2016 Essentials server using the task scheduler.

I created a small start.bat file:

DEL /F /S /Q .\l2cpbg.db .\l2cpbg.exe

and the related task scheduler entry:

However when I try to start the task via the task scheduler the created l2cpbg.log file shows:

D:\l2cpbg>DEL /F /S /Q .\l2cpbg.db Datei wurde gel”scht - D:\l2cpbg\l2cpbg.db\000000.vlog Datei wurde gel”scht - D:\l2cpbg\l2cpbg.db\MANIFEST
D:\l2cpbg>.\l2cpbg.exe 07:55:27 [ERR] Der Dienstprozess konnte keine Verbindung mit dem Dienstcontroller herstellen.

The funny thing is, I can start the start.bat batch file manually from the command line or the Explorer without any issues,
but not from the task scheduler. I'm using the same user to run and also tried the system user.

I also have other software (which not offers to be installed as a service) and it starts just fine in the same way I try to start l2cpbg. Only l2cpbg.exe won't start :(.

Do you have any idea?

Thx a lot.

Cheers,

Markus


Replies (6)

RE: How to start l2cpbg via the Task Scheduler - Added by Jörg Ebeling over 3 years ago

Hi Markus,

I guess it has something to do that l2cpbg can't find his config.
There are issues with no working directory when starting as service and probably also with the task scheduler.
You might try giving the --config option with an absolute config path as command line parameter.

However, I just finalized L2CPBG's Windows-Service functionality last night.
Not heavily tested, but it might solve your issue (please see attached beta5).
Please check the containing Readme section "Windows binary zip packages" for instructions.

What's the reason why you drop the DB in your start.bat?

Greetings

Jörg

RE: How to start l2cpbg via the Task Scheduler - Added by Jörg Ebeling over 3 years ago

When having any service- start/stop related issue with beta5, please be so kind and respond to ticket #36

RE: How to start l2cpbg via the Task Scheduler - Added by Markus Jessl over 3 years ago

Hi,

I changed my start.bat file as you suggested but I still can't start L2CPBG via the task scheduler.

start.bat
D: CD D:\l2cpbg DEL /F /S /Q .\l2cpbg.db D:\l2cpbg\l2cpbg.exe --config D:\l2cpbg\l2cpbg.conf

l2cpbg.log
D:\l2cpbg>D: D:\l2cpbg>CD D:\l2cpbg D:\l2cpbg>DEL /F /S /Q .\l2cpbg.db D:\l2cpbg>D:\l2cpbg\l2cpbg.exe --config D:\l2cpbg\l2cpbg.conf 12:09:56 [ERR] Der Dienstprozess konnte keine Verbindung mit dem Dienstcontroller herstellen.

Why I drop the DB in my start.bat

When I start l2cpbg.exe and not ending the program properly by killing the process (aka just close the window) instead of CTRL-C,
then I will not be able to restart L2CPBG again.
It looks like the DB gets corrupted.

18:15:37 [INF] LDAP-2-CardDAV (1 way read) Phone Book Gateway version 0.9.2beta4 18:15:37 [INF] Loaded config './l2cpbg.conf' 18:15:37 [INF] * Unregistered free version with approx. 12 requests per hour * 18:15:37 [INF] DB directory './l2cpbg.db' 18:15:37 [INF] All 0 tables opened in 0s 18:15:37 [INF] Replaying file id: 0 at offset: 0 18:15:37 [ERR] Open error Value log truncate required to run DB. This might result in data loss 18:15:37 [ERR] DB Open() failed with: Value log truncate required to run DB. This might result in data loss 18:15:37 [INF] Stopping... panic: runtime error: invalid memory address or nil pointer dereference [signal 0xc0000005 code=0x0 addr=0x0 pc=0xd24ed6] goroutine 8 [running]: github.com/dgraph-io/badger/y.(*Closer).Signal(...) /home/jebeling/Development/l2cpbg-go/vendor/github.com/dgraph-io/badger/y/y.go:204 github.com/dgraph-io/badger/y.(*Closer).SignalAndWait(...) /home/jebeling/Development/l2cpbg-go/vendor/github.com/dgraph-io/badger/y/y.go:231 github.com/dgraph-io/badger.(*DB).close(0xc0002cd500, 0xed0840, 0x119f780) /home/jebeling/Development/l2cpbg-go/vendor/github.com/dgraph-io/badger/db.go:374 +0x96 github.com/dgraph-io/badger.(*DB).Close.func1() /home/jebeling/Development/l2cpbg-go/vendor/github.com/dgraph-io/badger/db.go:363 +0x3a sync.(*Once).doSlow(0xc0002cd7f0, 0xc000419e50) /usr/lib/go-1.15/src/sync/once.go:66 +0xf7 sync.(*Once).Do(...) /usr/lib/go-1.15/src/sync/once.go:57 github.com/dgraph-io/badger.(*DB).Close(0xc0002cd500, 0xfb0f41, 0x8) /home/jebeling/Development/l2cpbg-go/vendor/github.com/dgraph-io/badger/db.go:362 +0xa5 projects.shbe.net/l2cpbg/internal/db.Close() /home/jebeling/Development/l2cpbg-go/internal/db/db.go:309 +0x73 main.(*program).Stop(0xc0003ce880, 0x11c1680, 0xc000414030, 0x0, 0x0) /home/jebeling/Development/l2cpbg-go/cmd/l2cpbg/l2cpbg.go:139 +0xca main.(*program).run.func1(0xc0003ce880) /home/jebeling/Development/l2cpbg-go/cmd/l2cpbg/l2cpbg.go:60 +0x56 main.(*program).run(0xc0003ce880) /home/jebeling/Development/l2cpbg-go/cmd/l2cpbg/l2cpbg.go:83 +0x27f created by main.(*program).Start /home/jebeling/Development/l2cpbg-go/cmd/l2cpbg/l2cpbg.go:51 +0x215

Regarding service-start/stop
I would like to have 2 separate instances of L2CPBG running since I have 2 phones with separate address books.
Does the beta5 allow to have multiple L2CPBG services running?

Thx again.

Cheers,

Markus

RE: How to start l2cpbg via the Task Scheduler - Added by Jörg Ebeling over 3 years ago

Hi Markus!

start.bat:
The start.bat with the added --config option still works when started from console? And load your "D:\l2cpbg\l2cpbg.conf" instead of the default ".\l2cpbg.conf" (get shown in one of the first log entries)
Does it get started with admin rights by task scheduler?
Do you have an error number for "Der Dienstprozess konnte keine Verbindung mit dem Dienstcontroller herstellen"? (because it is a windows error) Probably in event viewer?

DB drop:
Thanks a lot for the info. Yes, it look like the DB doesn't get closed correctly.
Will try to debug why DB shutdown will not happen on window close.

Multiple Services
Oh no, sorry. Forgot to evaluate this possibility.
Did you checked if service mode work (for a single instance) on your Win2016? (I only tested on Windows 10 and even if you do a non-service start, it get fired by the internal service manager as so called "interactive service". In addition we probably see another error which might help)

Kind regards

Jörg

RE: How to start l2cpbg via the Task Scheduler - Added by Markus Jessl over 3 years ago

Hi Joerg,

I was a bit busy the last days.

I didn't manage to start L2CPBG via the task scheduler.

However, your new service installer works fine (tested beta5 version) under Windows 2016.

As you already mentioned, currently it only supports one service instance.
When I try to install a second service instance via "l2cpbg.exe --service=install" I get the following error:
[FATAL] Failed to install LDAP-2-CardDAV Gateway: service l2cpbg already exists

So I will wait until you have time to create a multi instance capable version :).

Thx a lot.

Cheers,

Markus

RE: How to start l2cpbg via the Task Scheduler - Added by Jörg Ebeling over 3 years ago

Hi Markus,

thanks a lot for your response!

Well, I'm nearly done with 0.9.2 and like to finalize that first, in special because I expect some unseen issues with the new service-manager and need some user feedback for this.

I created feature request #42 so that I don't forget it again ;-), but it's now planned for 0.9.3.
If you're interested in an early multi-instance beta, please put yourself onto the watchlist of #42 so that you get informed.

Hear yea

Jörg

    (1-6/6)
    Go to top