How to autostart daemontools on Opensuse - daemon

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.

Related

How to find out who loads specific Linux kernel module?

I built a certain driver as module (m) for Linux, the spi-imx by NXP. Nontheless, Linux probes this driver when booting. I'm struggling to find out what process/other module/driver requests this spi-imx driver. A depmod does not show any dependencies between the spi-imx an other modules (except for the spidev as submodule).
After some research, I found out that Linux automatically (?) calls modprobe when it detects a new device. So does Linux actually call modprobe because the ecSPI'S status in the device tree as "okay"? If so, how can I prevent this? I would like to dynamically load the spi-imx from a user space application via modprobe. The story behind it: a coprocessor uses this SPI line in parallel to the Linux boot process. This interferes of course and interrupts the coprocessor's use of the SPI line. When the coprocessor has finished its transfer via SPI (a boot mechanism as well), it should hand over the SPI line to Linux.
I'm very thankful for any kind of tips, links, hints and comments on this.
Thanks a lot for the answers. As you guys mentioned, I also found out that Linux itself probes the device if present ("okay").
One possible solution is to complete cut off the modprobe call via an entry like "install spi-imx /bin/false" in the *.conf file. But that makes it impossible to load the driver via modprobe, for Linux and for user space.
"blacklist spi-imx" inside a *.conf located at /etc/modprobe.d/ is the way to prevent Linux from probing the driver when booting. After that, a modprobe from user space can successfully load the driver afterwards.
Thanks again & best regards

Wayland start application after wayland starts

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.

Nagios - installing custom plugin on Windows 7 that executes and sends back data to the server

I have setup Nagios 4 core on ubuntu machine and I have installed NSClient++ on windows 7 machine. For the out-of-box monitoring like CPU, memory , etc. everything works.
I also have written an EXE in .Net that gathers some metrics on the windows machine and the hope is that NSClient on the windows machine would execute this EXE and marshal these output back to the server. The problem is that I don't know how to install the plug in. Do you install it on the server? On the client? Both? If so where? Needless to say that ubuntu (where the nagios server is) shouldn't try to execute the .net EXE.
When I look at the configuration files on the server, I see that the nagios server uses Check_NT for communicating with the NSclient. We have a syntax like Check_nt!blah. Will I need to use the same syntax when executing my .Net EXE which is not part of the core?
I hardly found any detailed documentation as how to install a windows plugin and have the server and client talk to each other. So either it is extremely easy or extremely complicated. I also looked at some YouTube videos ...there is nothing there for the problem that I"m facing.
Any help is appreciated. Thanks all!
You'll want to define it as an NRPE check on your monitor, then define the check using the same name # NSClient++ on Windows. The NSClient++ configuration has a section for NRPE handlers, just for this (source: op5 kb):
[NRPE Handlers]
The nrpe handlers provide a way to execute any custom plugin/check command on the monitored Windows server. In this section you configure all the commands that should be available.
Adding a custom NRPE command to NSClient++ follow this syntax:
command[my_custom]=c:\mycustomdir\my_prog.exe
To test the check from your monitoring system you can use NRPE from the CLI to call my_custom:
./check_nrpe -H 10.0.0.1 -c my_custom
And then define the service in your Nagios config like so:
define service{
use generic-service
host_name windowshost
service_description CPU Load
check_command check_nrpe!my_custom
}
You may need to do some extra work to format the output correctly. In BASH, exit 1 and exit 0 are commonly used to indicate state, IE: OK/Critical (source), and you may find it easier to augment your EXE's output with some simple scripting like that.

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.

Start service in kernel mode (Vista)

I'd like to start service before user mode is loaded (in kernel mode).
The reason is I wanna run several system applications(asm code to write data to BIOS) that are not allowed in user mode (privileges problem).
That's why I got an idea: 1. Write windows service 2. Start and run it in kernel mode
Is it possible?
Are there any other ways to solve the problem?
I don't usually use Vista (use linux instead), that's why I'm asking.
Windows services are user-mode applications. To run in kernel-mode you should write a driver. (So-called "legacy" driver will be enough, see Driver Development Part 1: Introduction to Drivers).