Home » U++ Library support » U++ Core » Write an app to start and kill another app periodically
Re: Write an app to start and kill another app periodically [message #26391 is a reply to message #26388] |
Thu, 29 April 2010 19:18   |
|
Hi jpderyck,
I'm not sure if you know what you really want You were talking about GUI app on one side and periodical checks and service on the other. That doesn't get quite together 
If you want to have GUI, than what Koldo says is the good way for you to go. I just add other possibility, which doesn't require you to know process id: You can simply use the Sys function from U++ core: Sys("killall -SIGXYZ app"); You can substitute the "SIGXYZ" with any of the signal names Koldo mentioned above, or omit it totally to use default SIGTERM.
The other option is a "service". Actually on linux it is called daemon, but basically it a same thing That is just regular console application, and your system is set up to start or terminate it as necessary. This is usually done via initscripts. Some more advanced solutions (like upstart) also provide nice features like checking if the daemon runs, so it is restarted even when it terminates for some reason. Details depend on what distribution you use.
And there is also a third option. Don't write an U++ app at all. From what you said, I believe that all you need is a simple shell script #!/bin/sh
# here should be some check to see if the app is running or if it hangs,
# that would depend on how it hangs and how you can test it ...
killall "yourapp"
/path/to/yourapp
Then you can set up cron to launch it periodically, let's say every 5 minutes: echo $( crontab -l; echo '*\5 * * * * /path/to/the/script' For more details about cron and how to use it see man cron and man crontab.
There is probably many more options, but I think the last one is just the one you need. Also it uses just standard tools, so it can be used on almost any system.
Best regards,
Honza
[Updated on: Thu, 29 April 2010 20:11] Report message to a moderator
|
|
|
 |
|
Write an app to start and kill another app periodically
By: jpderyck on Thu, 29 April 2010 17:33
|
 |
|
Re: Write an app to start and kill another app periodically
By: koldo on Thu, 29 April 2010 17:51
|
 |
|
Re: Write an app to start and kill another app periodically
|
 |
|
Re: Write an app to start and kill another app periodically
By: jpderyck on Fri, 30 April 2010 10:32
|
 |
|
Re: Write an app to start and kill another app periodically
|
 |
|
Re: Write an app to start and kill another app periodically
By: jpderyck on Tue, 07 September 2010 15:16
|
 |
|
Re: Write an app to start and kill another app periodically
By: dolik.rce on Tue, 07 September 2010 15:55
|
 |
|
Re: Write an app to start and kill another app periodically
By: jpderyck on Tue, 07 September 2010 18:23
|
 |
|
Re: Write an app to start and kill another app periodically
By: dolik.rce on Tue, 07 September 2010 22:07
|
 |
|
Re: Write an app to start and kill another app periodically
|
 |
|
Re: Write an app to start and kill another app periodically
By: jpderyck on Wed, 08 September 2010 10:56
|
 |
|
Re: Write an app to start and kill another app periodically
By: jpderyck on Wed, 08 September 2010 10:36
|
 |
|
Re: Write an app to start and kill another app periodically
By: dolik.rce on Wed, 08 September 2010 11:25
|
 |
|
Re: Write an app to start and kill another app periodically
By: jpderyck on Wed, 08 September 2010 16:26
|
Goto Forum:
Current Time: Mon Jun 16 12:26:42 CEST 2025
Total time taken to generate the page: 0.04451 seconds
|