Re: Azureus restart script?

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

 



On 03Jun2013 10:10, Frank Murphy <frankly3d@xxxxxxxxx> 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,
-- 
Cameron Simpson <cs@xxxxxxxxxx>

"What do you want to reinstall today?"  - Bob O`Bob <obob@xxxxxxxxxxxxxxxxxx>
-- 
users mailing list
users@xxxxxxxxxxxxxxxxxxxxxxx
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




[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux