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.

Frank Chang frankchang91 at gmail.com
Fri May 13 23:37:57 UTC 2016


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. AudioRecorder.exe requires a shared object named
libaudiocontrol.so to perform its duties. This shared object has to be
found in the LD_LIBRARY_PATH location.

We will not have an Ubuntu Linux terminal to run when running in
mono-service mode. Instead we need to start an Ubuntu Linux service as
shown below:

Auto-start Checklist for Upstart

This section is a quick reference to make sure your service is set to
automatically start.

Configuration Checklist

Make sure the service has a functional Upstart init script located at
/etc/init/service.conf
    The /etc/init/service.conf file should contain a line like start
on runlevel [2345] to enable automatic starting after a reboot
    The /etc/init/service.conf file should also contain a line like
respawn to enable the service to respawn after a crash
Make sure there is no override file for the service: /etc/init/service.override

(There would be one only if you or another admin made one earlier)

Stop, then start, the service:

  sudo initctl stop service
  sudo initctl start service

Reboot the server.

  sudo reboot

Here is another way make sure your service is set to automatically start.

Auto-start Checklist for systemd

This section is a quick reference to make sure your service is set to
automatically start.

Configuration Checklist

Make sure the service has a functional systemd init script located at
/etc/systemd/system/multi-user.target.wants/service.service
Use the systemctl command to enable the service:

  sudo systemctl enable service.service

This should create a symlink in
/etc/systemd/system/multi-user.target.wants/ that looks like the
following (do NOT create this manually):

lrwxrwxrwx 1 root root 38 Aug 1 04:43
/etc/systemd/system/multi-user.target.wants/service.service ->
/usr/lib/systemd/system/service.service

This will enable automatic starting after a reboot.

The /etc/systemd/system/multi-user.target.wants/service.service file
should also contain a line like Restart=always under the [Service]
section of the file to enable the service to respawn after a crash
Reload the systemd daemon, followed by a restart of the service:

  sudo systemctl daemon-reload
  sudo systemctl restart service.service

I read in this URL:

http://stackoverflow.com/questions/10963498/mono-shared-library-under-linux-location
that you have to: LD_LIBRARY_PATH=. mono yourapp.exe. How might I do that
for a Linux service?

I also read Why change in LD_LIBRARY_PATH at Runtime dosen't Reflect on the
Executable once the Executable gets loaded
<http://stackoverflow.com/questions/19337926/why-change-in-ld-library-path-at-runtime-dosent-reflect-on-the-executable-once>
.

Could some expert comment on this URL and suggest a potential solution?

Any help is greatly appreciated.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20160513/c6b4215b/attachment.html>


More information about the ubuntu-users mailing list