Sunday, 31 July 2016 00:00

Discbox - Scripts to automatically rip CDs/DVDs and Blue-ray with multiple optical drives and no user intervention.

Written by

A set of linux bash scripts to automatically rip CDs/DVDs and Blue-ray discs across multiple optical drives without user intervention (headless).



This is a set of shell scripts and some configuration files that will automatically detect disk type and extract to a set of configurable folders automatically. A web-based interface is provided to monitor progress/report any errors. I am mounting various network drives and ripping to there.


It rips to the following formats/tools:-


Disc Format

Archive Format

Tools used


Both MP3 and FLAC together

(but in separate folders)

Ripit (lame and flac)



Uncompressed .ISO



Blue-ray folder on disk

MakeMKV (not free, but a beta serial number can be used)


Good Points:-


  • Disk insert detection
  • Automatic disc type identification
  • Web interface for progress monitoring (the only option in here is to cancel the current task, the rest is purely informational). Provides a tabbed view of each optical drive.
  • PC Speaker audible alerts (each drive has a different tone, on startup it plays a tone for each optical drive so you know they are present, another tone is played when ripping commences).


Bad Points:-


  • Everything currently runs as root. This was made for a dedicated appliance . If you want to use it on a general purpose PC you might want to try and sort out the security.
  • It's a bit rough and ready (but fully functional).



Distro requirements


The linux distribution I used was a base minimal console only (no GUI) install of Ubuntu LTS 16.04.

I used the Alternate CD and did a command line install.

The following (I may have missed some) need to be installed and all were available in the Ubuntu repos:-


udev ripit gddrescue apache2 libapache2-mod-php php shellinabox screen beep

apt-get udev ripit gddrescue apache2 libapache2-mod-php php shellinabox screen beep


Should get you going.


Also makeMKV (only required for Blue-ray) is not in the Ubuntu repos and will need to be built, so gcc etc. needs installing if you need this.

I'm using samba to mount other network drives as destination so you will need this and any fstab mounts at boot will need setting.

Beep – if you want PC speaker alerts, you may need to unblacklist pcspkr in /etc/modprove.d/blacklist-pcspkr


Installing the scripts


In order keep things tidy all the scripts should be installed in /opt/autorip. Symlinks can then be make to the necessary scripts and config files in order keep everything in one place.


Download and un-tar the files to /opt/autorip/



tar xvfz discbox.tar.gz


Here is a description of each file and where it needs symlinking to where necessary.




Symlink needed



The web-interface files.

Either replace your www/html directory to point here, or edit your apache config to point in here.

Web interface has been tested with Firefox and Chrome.


Uses shellinabox to provide a terminal view progress. A cancel button it also provided that will cancel the current task and eject the CD.


Provides logs for trouble shooting each rip.




Udev rules for disk insert notification.

Yes. Point /etc/udev/rules.d/10-srX_change.rules at this file.


i.e. -


cd /etc/udev/rules.d/

mklink /opt/autorip/ 10-srX_change.rules .

Supports up to 8 devices.


The sys V init script.


Yes. Point /etc/init.d/autorip at this.




update-rc autorip defaults

Set's up listeners for each optical drive and get's the shellinabox web-interface ready.

Script that does the actual notification to the script which is waiting on a FIFO.


Provides some filtering for ejections as udev doesn't seem to be able to tell an Insert for an eject.


The config file for setting destinations and a few other options.



STORAGE_MP3 is where MP3s are stored.

STORAGE_CD is where FLAC files are stored.

STORAGE_DVD is where DVD ISOs are stored.

STORAGE_BD is where Blue Ray folders are stored.


LISTENERS corresponds to the number of optical drives in the system.


Currently setting USER to anything other than root will almost certainly break everything.

The script that actually does the ripping.




A sudoers file that let's apache call the screen command as root to allow cancel to work.

Yes. Symlink to /etc/sudoers.d/sudoers_screen




Have fun and feel free to change whatever. Please leave any suggestions in the comments. The licence is public domain.


Thanks to the ripit guys for a fantastic tool.



Download - discbox.tar.gz




The web interface.



A dedicated box running the scripts. 6 optical drives are installed here.

If you found this useful please consider buying me a beer with a small donation using the PayPal button on the right. Many Thanks.


Last modified on Sunday, 16 October 2016 18:41

1 comment

Leave a comment

Make sure you enter all the required information, indicated by an asterisk (*). HTML code is not allowed.