F18 Azureus crashes out at times. Usually during middle of the night, an openjdk problem (already bz'd)
Is there a simple way to restart an app, auto-magically.
Without overkill like monit?
On 06/02/2013 03:43 AM, Frank Murphy wrote:
F18 Azureus crashes out at times. Usually during middle of the night, an openjdk problem (already bz'd)
Is there a simple way to restart an app, auto-magically.
Without overkill like monit?
You could write a shell script that will check to see if Azureus is running and restart it if it isn't. Call that script every 5 minutes, or whatever interval seems appropriate, from a cron job.
Does this look ok, ####### crontab -e # as logged in user */10 * * * * /home/frank/Scripts/checkazureus.sh # cat /home/frank/Scripts/checkazureus.sh #!/bin/bash if [-z "$(pgrep azureus)"] then /usr/bin/azureus else fi ###########
azureus normally starts with xfce session, but it can exit dues to openjdk bug.
If that's an X11 program, you're going to want to set DISPLAY before you invoke the command.
On Mon, Jun 3, 2013 at 5:10 AM, Frank Murphy frankly3d@gmail.com wrote:
Does this look ok, ####### crontab -e # as logged in user */10 * * * * /home/frank/Scripts/checkazureus.sh # cat /home/frank/Scripts/checkazureus.sh #!/bin/bash if [-z "$(pgrep azureus)"] then /usr/bin/azureus else fi ###########
azureus normally starts with xfce session, but it can exit dues to openjdk bug.
-- Regards, Frank - I check for new mail app. 20min www.frankly3d.com -- users mailing list users@lists.fedoraproject.org To unsubscribe or change subscription options: https://admin.fedoraproject.org/mailman/listinfo/users Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines Have a question? Ask away: http://ask.fedoraproject.org
On Mon, 3 Jun 2013 11:00:57 -0400 Jason Stelzer mental@neverlight.com wrote:
If that's an X11 program, you're going to want to set DISPLAY before you invoke the command.
On Mon, Jun 3, 2013 at 5:10 AM, Frank Murphy frankly3d@gmail.com wrote:
Does this look ok, ####### crontab -e # as logged in user */10 * * * * /home/frank/Scripts/checkazureus.sh # cat /home/frank/Scripts/checkazureus.sh #!/bin/bash if [-z "$(pgrep azureus)"] then /usr/bin/azureus else fi ###########
azureus normally starts with xfce session, but it can exit dues to openjdk bug.
-- Regards, Frank - I check for new mail app. 20min www.frankly3d.com -- users mailing list users@lists.fedoraproject.org To unsubscribe or change subscription options: https://admin.fedoraproject.org/mailman/listinfo/users Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines Have a question? Ask away: http://ask.fedoraproject.org
On Mon, 3 Jun 2013 11:00:57 -0400 Jason Stelzer mental@neverlight.com wrote:
If that's an X11 program, you're going to want to set DISPLAY before you invoke the command.
export DISPLAY=:0.0 ?
It can be run as gui\cli with a few extra bits: http://wiki.vuze.com/w/Console_UI (amend paths to suit fedora installed azureus)
On Mon, Jun 3, 2013 at 11:17 AM, Frank Murphy frankly3d@gmail.com wrote:
export DISPLAY=:0.0 ?
Depends on how many monitors you have and how X is setup, but yeah.. that's the general default. If you're unsure you can echo $DISPLAY in an terminal in x to see it.
On 03Jun2013 10:10, Frank Murphy frankly3d@gmail.com wrote: | | Does this look ok, | ####### | crontab -e # as logged in user | */10 * * * * /home/frank/Scripts/checkazureus.sh | # | cat /home/frank/Scripts/checkazureus.sh | #!/bin/bash | if [-z "$(pgrep azureus)"] | then | /usr/bin/azureus | else | fi | ########### | | azureus normally starts with xfce session, | but it can exit dues to openjdk bug.
I am concerned that you _clearly_ have not bothered to even run this script before posting to the list.
There are several problems:
Cron's environment is _very_ small. So you have no $DISPLAY setting and nothing in the script sets it; azureus will not be able to display on your screen
Test is a command, and so like any command it needs spaces around its name:
if [ -z "$(pgrep azureus)" ]
You have a dangling "else"; syntacticly invalid. Get rid of it.
If azureus is restarted, the script never exits. Background azureus and put its output into a log file:
/usr/bin/azureus >$HOME/azureus.out 2>&1 &
In fact, the argument to "if" is a command-list. So test pgrep directly and invert the "if":
if pgrep -q azureus then echo "azureus running!" else echo "restarting azureus" /usr/bin/azureus >$HOME/azureus.out 2>&1 & fi
But next time? Test drive the script yourself from the command line; half of this would have been found immediately.
Better than this script would be to run azureus in a loop to start with:
while : do azureus done
which will restart it if it quits anyway. No cron jobs playing guessing games.
Cheers,
On Tue, 4 Jun 2013 08:09:28 +1000 Cameron Simpson cs@zip.com.au wrote:
But next time? Test drive the script yourself from the command line; half of this would have been found immediately.
It was, hence the question, and no output to c&p.
Unfortunately, an empty else, was taught to us as a Java primitive.