open-source Notes

Notes of an open-source programmer.
08 Dec

boinc startup script and ubuntu

Zu diesem Artikel existiert auch eine Deutsche Version: ‘BOINC Startskript für Ubuntu‘!

UDATE 09/05/02: There is new version available for Ubuntu 9.x with more security and LSB compliant. Please upgrade your own scripts to the new version!

UPDATE 08/10/19: I updated the script a little bit. I replaced the none working restart section with a working one and gave the BOINC client more time to shut down until it is started again. You can now manually start, stop or restart the client with the following command (replace {action} with start, stop or restart!):
$ sudo /etc/init.d/boinc {action}

I’ve recently converted my WindowsXP machine at home to Kubuntu 7.10 Gutsy Gibbon and tried to set up my boinc client to start at boot time. Since I don’t need some fancy startup script I tried to write a short and plain one for myself. The official AutoStart documentation is not very helpful with latest releases, so I searched some help from other ubuntu users and, after some fiddling, I got a working startup script. It’s not very secure cause it’s running with root rights from startup. Perhaps I’ll find a way to circumvent this in the future. But here is how I’ve done it:

  1. Install the latest client available from the download page at berkeley. I’ve installed to /opt/BOINC and changed permissions for this directory so that I can read/write without using sudo.
  2. Create a script called ‘boinc’ within /etc/init.d/ with following content
    # /etc/init.d/boinc
    # Start/stop/restart
    test -x /opt/BOINC/boinc || exit 0
    case "$1" in
      echo "Starting BOINC."
      cd "/opt/BOINC" && exec ./boinc >>stdoutdae.txt 2>>stderrdae.txt &
      echo "Stopping BOINC."
      killall /opt/BOINC/boinc
      echo "Stopping BOINC. Will restart in 10sec."
      killall /opt/BOINC/boinc
      sleep 10
      echo "Starting BOINC."
      cd "/opt/BOINC" && exec ./boinc >>stdoutdae.txt 2>>stderrdae.txt &
      echo "Usage: /etc/init.d/boinc {start|stop|restart}"
      exit 2
    exit 0

    You should replace /opt/BOINC/ with the path you installed BOINC into.

  3. After that you have to make this script executable.
    $ chmod +x /etc/init.d/boinc
  4. And after that you have to generate symlinks for each runlevel. This command will do it all by itself:
    $ sudo update-rc.d boinc defaults
  5. That’s all. Now you can restart and check if it’s working.
    $ ps -A | grep boinc
    should return a line like:
    5182 ? 00:00:00 boinc

This should work an all other Ubuntu 7.10 distros also (like Xubuntu, Edubuntu, …), but I haven’t tested.

Leave a Reply

© 2017 open-source Notes | Entries (RSS) and Comments (RSS)

GPS Reviews and news from GPS Gazettewordpress logo