Re: Re: how to control a process programmatically

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 11/04/2019 08:48 AM, deloptes wrote:
> When I start the application it should check if a specific program is
> already started by the system or by other user - it doesn't matter. If this
> program was started - do nothing, if the program is not started - the user
> can decide to start it or not.

You can look at:

Quick-and-dirty way to ensure only one instance of a shell script is running
at a time
https://stackoverflow.com/questions/185451/quick-and-dirty-way-to-ensure-only-one-instance-of-a-shell-script-is-running-at

Whether you are starting the application from the shell or calling exec from
within an application, the process will be the same.

That is the basic reason for the Linux /run directory. At its simplest, form,
to ensure only one instance is running you simply check whether a pidfile
exists in some directory, and if not start the app and write the pid of the
application to the pidfile. This provides the benefit of being able to simply
read the pidfile to get the pid of the current running instance.

-- 
David C. Rankin, J.D.,P.E.

---------------------------------------------------------------------
To unsubscribe, e-mail: trinity-devel-unsubscribe@xxxxxxxxxxxxxxxxxxxxxxxxxx
For additional commands, e-mail: trinity-devel-help@xxxxxxxxxxxxxxxxxxxxxxxxxx
Read list messages on the web archive: http://trinity-devel.pearsoncomputing.net/
Please remember not to top-post: http://trinity.pearsoncomputing.net/mailing_lists/#top-posting




[Index of Archives]     [Trinity Users]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [KDE]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]     [Trinity Desktop Environment]

  Powered by Linux