I have a handful of console apps installed as services running under topshelf and if I install and run manually they work fine. However none automatically start even though the startup type is set to Automatic.
The apps are configured as follows:
HostFactory.Run(x =>
{
x.Service<MyApp>(s =>
{
s.ConstructUsing(name => container.Resolve<MyApp>());
s.WhenStarted(tc => tc.Start());
s.WhenStopped(tc =>
{
tc.Stop();
container.Dispose();
});
});
x.RunAsLocalSystem();
x.StartAutomatically();
x.EnableServiceRecovery(rc => rc.RestartService(5));
});
The apps run under Win 2008 R2 and they are installed using a batch file executed as Admin. The batch file includes the following:
app.exe install --sudo
app.exe start
After executing the the batch file the services run as expected. However if I reboot they remain stopped.
The event log returns the same pair of events for each service:
Event 7000: The service failed to start due to the following error:
The service did not respond to the start or control request in a timely fashion.
Event 7009: A timeout was reached (30000 milliseconds) while waiting for the service to connect.
The only way to start the app after a reboot is to run app.exe start from an elevated command prompt.
Any ideas?
OK i've fixed it. The service startup types were set to Automatic but i've changed them to Automatic (Delayed) and all now run properly on start-up.
Also i've modified the install batch files for future use:
app.exe install --delayed --sudo
app.exe start
Only a guess, but probably dependent on network services which might not be available.
The most likely answer is that it's taking too long for the container to get created and resolved during start up when other stuff is happening on the machine. When you do it manually, nothing else is vying for resources. Can you defer some of the work done in your container until after creation & start? You can also request more time, but I don't recall that API off the top of my head.
Related
Is there a way of setting up some type of CRON job on the Netscaler VPX running firmware 11.0 to automatically clear Persistence Session Records on a daily basis?
https://docs.citrix.com/en-us/netscaler/12/load-balancing/load-balancing-persistence/clearing-persistence.html
in the /nsconfig folder you have a rc.netscaler file.
Make a entry in the rc.netscaler where you add the cron job.
When you reboot the rc.netscaler will be executed.
You can also put files in the /var directory (survives reboot) and use an entry in /nsconfig/rc.netscaler to copy to /etc/....
setup a cron job on the netscaler freebsd. use the following structure for your command:
nscli -U xxx.xxx.xxx.xxx:nsroot:nsroot "clear lb persistentSessions"
edit to add the following note: keep in mind you will most likely impact anyone connected at the time when running this command (depends on your application)
My goal is to import data from CSV-files into OrientDB.
I use the OrientDB 2.2.22 Docker image.
When I try to execute the /orientdb/bin/oetl.sh config.json script within Docker, I get the error: "Can not open storage it is acquired by other process".
I guess this is, because the OrientDB - service is still running. But, if I try to stop it i get the next error.
./orientdb.sh stop
./orientdb.sh: return: line 70: Illegal number: root
or
./orientdb.sh status
./orientdb.sh: return: line 89: Illegal number: root
The only way for to use the ./oetl.sh script is to stop the Docker instance and restart it in the interactive mode running the shell, but this is awkward because to use the "OrientDB Studio" I have to stop docker again and start it in the normal mode.
As Roberto Franchini mentioned above setting the dbURL parameter in the Loader to use a remote URL fixed the first issue "Can not open storage it is acquired by other process".
The issues with the .orientdb.sh still exists, but with the remote-URL approach I don't need to shutdown and restart the service anymore.
Hi I am running my functional tests using geb.
I am able to run tests on my local computer correctly. but as I deploy my application to server. the build for functional tests fails.
Here is my console output
|Running 10 spock tests... 1 of 10
Failure: |
sign in with voucher
|
geb.driver.DriverCreationException: failed to create driver from callback 'script14007213321291157436758$_run_closure1#77068fce'
at geb.driver.CallbackDriverFactory.getDriver(CallbackDriverFactory.groovy:35)
at geb.driver.CachingDriverFactory.getDriver_closure3(CachingDriverFactory.groovy:80)
at geb.driver.CachingDriverFactory$SimpleCache.get(CachingDriverFactory.groovy:30)
at geb.driver.CachingDriverFactory.getDriver(CachingDriverFactory.groovy:79)
at geb.Configuration.createDriver(Configuration.groovy:346)
at geb.Configuration.getDriver(Configuration.groovy:335)
at geb.Browser.getDriver(Browser.groovy:105)
at geb.Browser.go(Browser.groovy:377)
at geb.Page.to(Page.groovy:171)
at geb.Browser.via(Browser.groovy:454)
at geb.Browser.to(Browser.groovy:413)
at geb.Browser.to(Browser.groovy:391)
at geb.spock.GebSpec.methodMissing(GebSpec.groovy:51)
at VoucherSpec.sign in with voucher(VoucherSpec.groovy:14)
Caused by: org.openqa.selenium.WebDriverException: Failed to connect to binary FirefoxBinary(/usr/local/bin/firefox) on port 7056; process output follows:
Error: no display specified
Error: no display specified
Can anyone guide me to solve this issue.
The server you're running the tests on is 'headless' so doesn't have a display to start Firefox on to run the tests. You've got a couple of options:
Switch from Firefox to a headless browser such as HTMLUnit.
Configure a virtual display on the server.
Use a remote browser service such as SauceLabs.
If you need to test directly on Firefox then HTMLUnit isn't an option for you.
Using a remote browser service such as SauceLabs or BrowserStack has a couple of advantages, for example they record a video of the session and take screenshots, but we found the overhead of passing commands & traffic over the network made the tests unacceptably slow. If you need to test a wide variety of browsers then the overhead diminishes because you can run in parallel...
Option 2, using a virtual display, is the simplest to configure on most servers. If you're using Linux the X Virtual Frame Buffer (XVFB) will get you up and running quickly. It's worth reading up on what's going on but the short answer is:
Install XVFB (sudo apt-get install xvfb)
Install Firefox (sudo apt-get install firefox)
Start XVFB (sudo Xvfb :10 -ac -screen 0 1024x768x8 &). You may want to add an init script so this happens every time the server starts
In your CI server add export DISPLAY=:10 as a step before the tests are run
Run your tests
The XVFB creates a virtual display on :10, which you then set as the default display. When you start Firefox it's completely unaware that it's on a virtual display, so things like getting Geb to take screenshots of failing tests will work as normal.
For more information about the steps see:
http://www.installationpage.com/selenium/how-to-run-selenium-headless-firefox-in-ubuntu/
https://github.com/tomaslin/grails-test-recipes
http://www.semicomplete.com/blog/geekery/xvfb-firefox.html
http://www.labelmedia.co.uk/blog/setting-up-selenium-server-on-a-headless-jenkins-ci-build-machine.html
http://manpages.ubuntu.com/manpages/lucid/man1/xvfb-run.1.html
If you need an init script to get it to start/stop, then there are quite a few to choose from, such as this one.
I have googled for three hours but to no avail.
I have an ejabberd installation which is not installed using apt. It is installed from source and there is no program called ejabberd in it. Start and Stop and everything is through ejabberdctl.
It was running perfectly for a month and all of a sudden one day it stopped with the infamous
kernel pid terminated error
Anytime i do
sudo ejabberdctl start --node ejabberd#MasterService
A erl_crash file gets generated and when i try
ejabberdctl
i get
Failed to connect to RPC at node ejabberd#MasterService
Now what have i tried
Tried killing all running process of ejabberd, beam, epmd and starting fresh - DID NOT WORK
Checked /etc/hosts and hostname and all is well. Hostname is provided in hosts file with the IP
Checked the ejabberdctl.conf file to ensure teh host name is indeed right and the node name is right
checked .erlange.cookie file is being created with content in it
In all of web one way or another the search led me to either one of the above.
I have nowhere else to go and dont know where else to look. Any help would be much appreciated.
You'll have to analyze the crash dump to try to guess why it failed.
To carry out this task, Erlang has a special webtool (called, uh, webtool) from which a special application — Crash Dump Viewer — might be used to load a dump and inspect the stack traces of the Erlang processes at the time of the crash.
You have to
Install the necessary packages:
# apt-get install erlang-webtool erlang-observer
Start an Erlang interpreter:
$ erl
(Further actions are taken there.)
Run the webtool. In a simplest case, it will listen on the local host:
webtool:start().
(Notice the period.) It will print back an URL to navigate in your browser to reach the running tool.
If this happens on a server, and you'd rather like to have the webtool listen on some non-local-host interface, the call encantation would be trickier:
webtool:start(standard_path, [{port, 8888}, {bind_address, {0, 0, 0, 0}}, {server_name, "server.example.com"}]).
The {0, 0, 0, 0} IP spec will make it listen everywhere, and you might as well specify some more sensible octets, like {192, 168, 0, 1}. The server_name clause might use arbitrary name — this is what will be printed in the generated URL, the server's hostname.
Now connect to the tool with your browser, navigate to the "Start tools" menu entry, start crash dump viewer and make a link to it appear in the tool's top menu. Proceed there and find a link to load the crash dump.
After loading a crash dump try to mess around with the tool's interface to look at the stack traces of the active Erlang processes. At least one of them should contain something fishy, which should include an error message — that's what you're looking after to refine your question (or ask another at the ejabberd mailing list).
To quit the tool, run
webtool:stop().
in the running Erlang interpreter. And then quit it either by running
q().
and waiting a bit or pressing Ctrl-g and then entering the letter q followed by pressing the Return key.
The relevant links are: the crash dump viewer manual and the webtool manual.
I have a JRuby program that I want to be a windows service. I have seen some things on creating a service with Ruby, but we don't want to install ruby on our client machines. It appears to be not supported in JRuby.
I created a dummy program to try this out:
path = "C:/tmp/my-svc.log"
if File.exists?(path)
File.open(path,"a"){|f| f.write(" called again\n")}
else
File.open(path,"w"){|f| f.write(" called first time\n")}
end
while true do
sleep 5
puts 'I am a service'
end
I did this:
Z:\play>sc.exe create "larz service 2.1" binpath= "C:\jruby-1.6.7.2\bin\jruby -S Z:\play\my-win-svc.rb" start= auto
[SC] CreateService SUCCESS
Trying to start it I got this error:
Z:\play>sc start "larz service 2.1"
[SC] StartService FAILED with error 193.
Z:\play>sc query "larz service 2.1"
SERVICE_NAME: larz service 2.1`
TYPE : 10 WIN32_OWN_PROCESS`
STATE : 1 STOPPED
WIN32_EXIT_CODE : 0 (0x0)
SERVICE_EXIT_CODE : 0 (0x0)
CHECKPOINT : 0x0
WAIT_HINT : 0x0
I have seen alot of posts on the web on different ways to create windows services, using initsrv.exe, powershell, running CMD, editing the registry and so on, but I am not sure what is really going on or if I need to call some API. It doesn't appear as if the other approaches add any specific start parameters that I could tell. In addition, I added code at the beginning of my test service to write to a file in /tmp and the file is not being written so when I try to start the program, it never actually is being executed.
Thanks ..
Ok, so I got a little farther, but still mystified
Z:\play>sc config "larz service 2.2" obj= EEE\lgud password= "Ssssssss#"
[SC] ChangeServiceConfig SUCCESS
Z:\play>sc start "larz service 2.2"
[SC] StartService FAILED 1069:
the service did not start due to a logon failure.
It seems I entered the correct format for user/pw as at other times it errored out on the config command.
If you are positive that the password is correct, perhaps the user you have specified doesn't have the right privileges to run as a service. Try entering the account information on the Windows Services Application (services.msc) Log On tab, which will let you know if there is a problem with that user.
But beyond that, I don't see how you're going to get this going without Ruby installed. Your service's executable path is set to a .rb file -- what application do you expect Windows to launch to run that file, if not Ruby?