Main Problem
I am attempting to automate the loading of drivers for my system. The drivers were built manually and must be loaded manually. Another caveat is that one of the system drivers must be loaded and offloaded before manually inserting the built drivers. From the CLI, it looks something like this:
modprobe gspca_main && rmmod gspca_main && modprobe videodev && insmod gspca_main.ko && insmod gspca_kinect2.ko
Options
I want to automate this at boot so that I don't have run the above each time. As I currently see it, I have several options:
- Cron
It looks as though I could use the @reboot string here to run the script
- Init
Alternatively, I thought about creating an init
script but I don't necessarily need all the control over runlevel
's or execution timing. Here I haven't seen any instances of multiples Exec
's which would be necessary per "the other thing".
- Modprobe
Adding a conf
file under /etc/modprobe.d
seemed to make the most sense since, after all, I am trying to load some drivers. The only problem with this option is that I am not sure if drivers can be sequentially onloaded and then offloaded.
The other thing
The other part in all this is that after the drivers are loaded, I need to run a script as well:
#!/bin/sh
sudo rmmod v4l2loopback
sudo modprobe v4l2loopback video_nr=10 card_label="Kinect v2"
ffmpeg \
-i /dev/video0 \
-vsync drop \
-filter:v fps=30,scale=1280:-1,hflip \
-pix_fmt yuyv422 \
-color_trc bt709 \
-color_primaries bt709 \
-color_range tv \
-f v4l2 \
/dev/video10
Which would seem to better fit under cron
or init
.
Which option is the best compromise of stability and ease of configuration?
Thanks in advance for any/all help!