Linux.com

Home Linux Community Forums Linux Distributions Ubuntu Anyone Know Howto Create a KeepAlive Script?

Anyone Know Howto Create a KeepAlive Script?

Link to this post 14 May 09

I run Gnome-Do's Docky interface on a number of systems and occasionally it can crash. I am looking for a way to write a keep alive script that will monitor gnome-do and if it crashes restart it.

Thanks

Link to this post 14 May 09

There are several way of fulfilling your requirement. First, your script can make use of pidof to check the pid of the command you wish to monitor. If the pid is empty, there is a possibility of the process is dead, so you run the software again.

Now, the problem is that the software is running on an X environment and the process is owned by the currently logged user. So, when you run the software again, you need to know what user privilege you are going to run the software and the display environment.

I hope my answer could give some enlightenment.

Regards,

Joko

Link to this post 15 May 09

Xipher_Zero wrote:

I run Gnome-Do's Docky interface on a number of systems and occasionally it can crash. I am looking for a way to write a keep alive script that will monitor gnome-do and if it crashes restart it.

Thanks

I typically use a perl wrapper (i.e., daemon) for this sort of thing. The perl script starts up, detaches from the terminal, then loops indefinitely, waking up at some interval i specify to run my generic command. In your case, i might ps/pidof |grep Do Docky and relaunch it, if not running. If you're interested, i can dig up a skel of the perl daemon. the same thing can be done in bash, too, if that's more your thang.

Link to this post 15 May 09

atreyu wrote:

[b]Xipher_Zero wrote:[/b]
[quote]I run Gnome-Do's Docky interface on a number of systems and occasionally it can crash. I am looking for a way to write a keep alive script that will monitor gnome-do and if it crashes restart it.

Thanks

I typically use a perl wrapper (i.e., daemon) for this sort of thing. The perl script starts up, detaches from the terminal, then loops indefinitely, waking up at some interval i specify to run my generic command. In your case, i might ps/pidof |grep Do Docky and relaunch it, if not running. If you're interested, i can dig up a skel of the perl daemon. the same thing can be done in bash, too, if that's more your thang.[/quote]

Thank you! I'd really appreciate it, I am not a programmer and a skel to start from would be a great help!

Link to this post 15 May 09

Thank you I will check it out!

Who we are ?

The Linux Foundation is a non-profit consortium dedicated to the growth of Linux.

More About the foundation...

Frequent Questions

Join / Linux Training / Board