How do we do programmatically set LD_LIBRARY_PATH for this scenario , mono-service ./AudioRecorder.exe where we are running on Ubuntu Linux 14.06 and AudioRecorder.exe is a C# .NET executable.

Karl Auer kauer at biplane.com.au
Sat May 14 04:14:16 UTC 2016


On Fri, 2016-05-13 at 22:05 -0400, Frank Chang wrote:
> How might I set up or initialize the LINUX service to do:
>  mono -service ./AudioRecorder.exe?

Before you read this, can I just ask whether you have googled "mono
-service" at all? I just did (because I had never heard of mono
-service) and there are REAMS of pages detailing how to run it as a
service. Please check that out, try it, and get back to us if you are
still stuck.

There are several ways to get something working as a service. You can
just tack it onto the end of /etc/init.d/rc.local. You can set up a
script in /etc/init.d and use update-rc.d to enable it. You can set up
a conf file in /etc/init. Or you can set up a service in /etc/systemd.

If you want to run it as a systemd service, it should be as simple as
having something like this in the service stanza of your services file:

Environment=LD_LIBRARY_PATH=whatever
ExecStart=/path/to/mono-service /path/to/AudioRecorder.exe

Look at one of the existing services - such as sshd - and copy it.

You might want to read the man pages covering systemd. You can get a
list of them using the command "apropos systemd". There are a LOT of
man pages :-) You can probably get what you need by taking a similar
existing service (such as sshd) and reading the man pages for: 

   systemd
   systemd.unit
   systemd.service
   systemd.exec
   systemctl

And also check out:

   http://www.freedesktop.org/wiki/Software/systemd/

... especially the section "Manuals and Documentation for Users and
Administrators".

> After that, How do I start up all the LINUX services in a way 
> analogous to Windows services?

That's exactly what systemd does; it's already doing it on any Ubuntu
system. If you add your own service definition files in the systemd
directories, you can run anything you like as a service.

Regards, K.

-- 






More information about the ubuntu-users mailing list