Ivor O’Connor

February 15, 2009

Ubuntu, cron, and synergy

Filed under: Uncategorized — ioconnor @ 9:34 pm

I wrote how to remove the sudo depenceny on commands, in particular synergyc, on a prior post.
This post shows how to automatically start a process that may die, in particular synergyc, so as to automate tasks.

#!/bin/bash
RESTART="synergyc 192.169.1.101"
PGREP="/usr/bin/pgrep"
DAEMON="synergyc"

$PGREP ${DAEMON} | grep -v $$
if [ $? -ne 0 ] # if daemon not running
then
$RESTART
fi

and store it somewhere, perhaps in the file /usr/bin/synergyc-monitor.bsh, and set the mod bits appropriately.

Now under ubuntu 8.10 you can simply type:

crontab -e

and enter a new line like:

* * * * * /usr/bin/synergyc-monitor.bsh >/dev/null 2>&1

That’s all there is to it. Now my synergyc will start automatically after each mysterious crash. Though it may take a minute or so to restart.

Advertisements

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: