Wayland start application after wayland starts - yocto

Hi I'm trying to sort of autostart an applocation in Wayland, so that it starts after the sesktop is visible. I can start it manually via ssh via openvt but the problem is it wont start if I add it for instance into a service.
It just crashes. Does any one know how to autostart an app like that?
I'm using Poky (yocto) 2.1.2 with renesas' meta-renesas bsp 2.19 wayland 1.11
Update:
To be more precise it is Yocto's Poky built for Renesas' R-Car with wayland as manager. Poky 2.1.2

As Fl0v0 mentions, it depends on which init system you use.
If you use sysvinit, you have to mention this in your script:
# Required-Start: <wayland service>
On systemd:
a.service
[Unit]
After=b.service
Original sources: sysvinit and systemd

So I have finally figured it out what I was doing wrong.
Tu put it short I had to use openvt to start the application (and curiously some delay in seconds despite using After=weston.service ) and the applications started successfully.

Related

DBus how to start service

I am curious how to start my own service for DBus.
On official site I have found a lot of information regarding working with DBus services from client point of view, but how to start and develop service not enough:
1) Where should be located interface file ServiceName.xml
2) Where should be located service file ServiceName.service
3) How to launch service manually, not on start of system.
Can anybody help me or provide some usefull links ?
Make a service that is started by the service manager of the OS (initd, systemd,etc). In that program instantiate the server-side object using the dbus library.
Normally, you'll configure to start the service on boot, but with systemd it's also possible to configure it to start when something connects to specific socket or when something tries to use specific device object. It's called 'socket activation' and 'dbus activation' (see current systemd docs).
If you want to start service manually - then do systemctl disable <service-name> to disable start on boot. To start a service manually: systemctl start <service-name>.
The *.xml files aren't obligatory. Maybe look into other packages to see where they put these files.
The *.systemd files should be in some usual place (see systemd docs) like /usr/lib/systemd/system.

How to run the Play's dist file in the background?

When I deployed my play application I built the package using:
dist
This created a file that I can run on my server like:
sudo ./bin/app-name -Dhttp.port=9090
This works fine for testing but how can I run this process in the background?
I will eventually have to use upstart or some sort of process monitoring tool to make sure this process is running after server reboots etc.
Using play 2.3.x
Since you are on ubuntu
sudo ./bin/app-name -Dhttp.port=9090 &
should do the trick.
Ceating the upstart script is also fairly easy https://askubuntu.com/questions/18802/how-to-correctly-add-a-custom-daemon-to-init-d
In your case it would be in /etc/init/app-name.conf and look like
# app-name
#
start on stopped rc RUNLEVEL=[2345]
stop on runlevel [!2345]
respawn
exec $PATH_TO_APP/bin/app-name -Dhttp.port=9090
Of course you will want to change the RUNLEVEL and the PATH_TO_APP
That of course depends on the system at which you're deploying the app, anyway in general you need to run it as a deamon.
Refer to your system's documentations, I'm pretty sure that you will find tutorial very soon.

Why won't my Telescope app start with Upstart?

I've followed instructions online to set up a Telescope instance on my DigitalOcean droplet, but it won't start with Upstart.
I'm able to run the server successfully manually, but the Upstart task doesn't fire when the server boots. I'm sure I should be looking at a log file somewhere to discover the problem, but I'm not sure where.
I've looked for the location of upstart logs, but I'm not having any luck. Either you have to add something to your script to make it log, or it just does it according to accounts online, but neither of those seem to be the case for me.
When I try to search for help on Upstart, I'm also seeing people saying I should be using systemd instead, but I can't figure out how to install it on CentOS 6.5.
Can anyone help me figure a way out of this labyrinth?
I use Ubuntu server 14.04, and my upstart logs are located in /var/log/upstart
The log usually contains stdout from the job, and it should help you understand what's wrong.
My guess is that when the server boots and tries to run your job, MongoDB is not yet ready so it fails silently.
Try installing the specific MongoDB version that Meteor is using at the moment (2.4.9) using these docs :
http://docs.mongodb.org/v2.4/tutorial/install-mongodb-on-ubuntu/
The most important thing is to get upstart support for MongoDB, this will allow us to catch mongod launch as an event.
You can then use this syntax in your upstart script :
start on started mongodb
This will make your node app start when mongo is ready.
I've created a gist with the scripts I wrote to setup a server ready for Meteor app deployment, it's a bit messy and probably specific to Ubuntu but it might help you.
https://gist.github.com/saimeunt/4ace7975b12df06ee0b7
I'm also using demeteorizer and forever which are two great tools you should probably check.

Cannot disable systemd serial-getty service

On Raspberry Pi with Arch Linux there is a service active called serial-getty#AMA0.
The unit file is: /usr/lib/systemd/system/serial-getty#.service
As root I can invoke
systemctl stop serial-getty#ttyAMA0
systemctl disable serial-getty#ttyAMA0
But after reboot the service is enabled and running again.
Why is the service enabled after disabling it? How can I disable it permanent?
UPDATE
systemd uses generators at /usr/lib/systemd/system-generators/ is a binary called systemd-getty-generator. This binary runs at system start and adds the symlink serial-getty#ttyAMA0.service to /run/systemd/generator/getty.target.wants.
I eventually found a dirty solution. I commented out all actions in /usr/lib/systemd/system/serial-getty#.service. The service did appear to start anyway, but without blocking ttyAMA0.
The correct way to stop a service ever being enabled again is to use:
systemctl mask serial-getty#ttyAMA0.service
(using ttyAMA0 as the example in this case). This will add a link to null to the entry for that service.
Try this code:
system("systemctl stop serial-getty#ttyAMA0.service");
system("systemctl disable serial-getty#ttyAMA0.service");
I use it, and it works well.

How to autostart daemontools on Opensuse

I am trying to create daemon from script written in php.
My system is running OpenSuse 11.3 and has http://cr.yp.to/daemontools.html installed from contrib package (http://download.opensuse.org/repositories/openSUSE:/11.4:/Contrib/standard/x86_64/daemontools-0.76-1.2.x86_64.rpm)
The question is - how do I autostart svscanboot in OpenSuse?
Add something like:
SK:2345:respawn:/usr/bin/svscanboot
to the end of /etc/inittab
The SK prefix is just any unique 1-2char identifier.
Be aware that this method of starting daemons has issues if they depend on other services being available.