open-source Notes

Notes of an open-source programmer.
02 May

new and improved startup script for Ubuntu 9.x

I just upgraded my computer to the new Ubuntu release Jaunty Jackalope (9.04). Mainly because of the KDE4 support. I got my main applications running (Firefox, Kopete, Amarok, BOINC), although the last was a bit tricky. The init script for the former Ubuntu releases (7.x, 8.x) was criticized by the system, so I decided to upgrade the script. There already was an example available at /etc/init.d/skeleton and I just had to customize it for the BOINC client. It’s now possible to start the BOINC client with user rights instead of root privileges! Because of the length of the script I’ll make it available as download at the end of this article on how to install this script by hand.

The script is now Linux Standard Base (LSB) compliant, means that it is future proof and compatible with other Linux distributions. At first there is an information header:

### BEGIN INIT INFO
# Provides:		boinc
# Required-Start:	$local_fs $network
# Required-Stop:	$local_fs $network
# Default-Start:	2 3 4 5
# Default-Stop:		0 1 6
# Short-Description:	Start BOINC daemon at boot time
# Description:		Enables the BOINC client without logging in
### END INIT INFO

Furthermore there is a section for directory and startup configuration:

USER=christian
DESC="BOINC client daemon"
NAME=boinc
WORKDIR=/opt/BOINC
DAEMON=$WORKDIR/$NAME
DAEMON_ARGS="--daemon --redirectio"
SCRIPTNAME=/etc/init.d/$NAME

You have to change the path to your BOINC installation (WORKDIR) here. The script will then automatically set the correct entries for the runlevels. You should also define a username under which account the BOINC client is started. That’s way more secure than running it as root. You can also create a special user just for the BOINC client. This will be covered by a future article.

The command-line parameters daemon and redirectio ensure that the client is launched in the background and all output is redirected into files. This options are undocumented but work for the 6.4.5 version for Linux.

After this short introduction here are the instructions for installing the init script:

  1. If not already done you should download and install the latest official Client for Linux. I created the directory /opt/BOINC/ for this. You are free to choose your own place, just make sure the permissions are set correct. The user defined in the header of the script needs read and write permissions to all folders beneath /opt/BOINC/ (including itself).
  2. Create the file /etc/init.d/boinc (root permissions needed) and insert the content of the BOINC initscript (Don’t forget to customize the WORKDIR and USER variables!).
  3. Now give the script the right to be executable:
    $ sudo chmod +x /etc/init.d/boinc
  4. What’s left are the entries for each runlevel. Due to the information header this is done by update-rc.d.
    $ sudo update-rc.d boinc defaults
  5. Now you’ll have to start the daemon manually for the first and last time and check if it’s running.
    $ sudo /etc/init.d/boinc start
    $ ps -A | grep boinc
  6. The last command’s output should look like:
    5182 ? 00:00:00 boinc

For questions, improvements or other help you can comment directly under this article or send a mail to open.source.notes [ at ] googlemail.com.

Leave a Reply

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

GPS Reviews and news from GPS Gazettewordpress logo