Ubuntu: How to run the FlexRAID server on boot
NOTE: This guide has been written for Ubuntu Lucid Lynx 10.04 although it may work equally well on earlier or later version of Ubuntu.
In the how to install FlexRAID guide I explained how to install the FlexRAID Server and how to launch it. However, each time you reboot your server you will need to re-launch it again. You can either do this manually each time (by issuing the relevant command) or you can get a script to do it for you. We’ll use a script. The script will run automatically each time the server boots and so all we’ll need to do going forward is to launch the FlexRAID Web Client itself when we want to administer FlexRAID.
So, type the following command in your Putty Session to create and open the script:
sudo vim /etc/init.d/FlexRAID
Next, highlight and copy this script.
Toggle back to your Putty Session and press the [Insert] key once and add a couple of blank lines by pressing the [Enter] key. Next right click and the whole script you’ve just highlighted will be pasted into the screen.
Now press the [Esc] key once and type :wq to save and quit out of the script. If you make a mistake editing the file then issue :q! instead of :wq to abort your changes.
We now need to make this script executable. So:
sudo chmod a+x /etc/init.d/FlexRAID
Now we need to make sure this script runs on start-up. To do this type the following command:
sudo update-rc.d FlexRAID defaults
If you have a pre-existing FlexRAID configuration
If you’ve already configured your FlexRAID array(s) before finding this page then the “config database” may be stored under your home directory. Once you’ve followed this guide FlexRAID will now be looking for the config database under root. So, check whether the config database (FlexRAID-Config.db) exists under your home folder and if it does then issue the following two commands to fix this:
sudo mv /home/YourUserName/FlexRAID-Config.db /root/FlexRAID-Config.db
sudo chown root:root /root/FlexRAID-Config.db
where YourUserName is your Ubuntu username.
Now cross your fingers and restart the server by typing the following command:
sudo reboot -h now
You should now be able launch the FlexRAID Web Client (ie. type http://mymediaserver:8080/ into your browser)
How to start and stop the FlexRAID Server
If you ever need to stop the FlexRAID Server then you can do so by issuing the following command:
sudo service FlexRAID stop
To start it, use start instead of stop in the above command. restart will restart the script.
Where is the FlexRAID Log kept?
Whenever FlexRAID does anything (resynch, validate, verify) it writes a log file to the installation directory. Issue the following command to view the log:
cat /var/lib/flexraid/log.log
If the log is long then you can issue the more command to view a page at a time:
more /var/lib/flexraid/log.log
Press the Spacebar to advance a page at a time. To escape at any time and return to the command prompt hit the letter q.