7.3.1. Simple rc.local
In this section, we’ll use rc.d.
$ sudo apt-get install screen python-pip
or:
$ sudo yum install screen python-pip
Then:
$ sudo pip install supervisor
$ sudo pip install superlance
Second, install
Xvfb (X Virtual Framebuffer). For this, please refer to the
Running Headless section in
Install.
Next, let’s assume UXTR was installed under the user name batman ( i.e /home/batman/.uxtr/ ).
On Debian/Ubuntu and derivatives, append the following lines to the file /etc/rc.local to read this:
#!/bin/sh -e
#
# rc.local
#
# ...
## Xvfb
su -c "/usr/bin/screen -dmS xvfb Xvfb :99 -screen 0 1024x768x24 -ac -noreset"
## UXTR
USER="batman"
su - $USER -c "/usr/bin/screen -dmS uxtr env DISPLAY=:99 /home/$USER/.uxtr/Supervisor"
exit 0
Depending on your system, you may have to adjust the memmon command path accordingly:
$ MEMMON=`type -p memmon`
$ sed -i "s|%MEMMON%|$MEMMON|" $HOME/.uxtr/etc/supervisord.conf
You may also want to adapt the file /home/batman/.uxtr/etc/supervisord.conf to fit your
needs (auth, email address, alert thresholds, mask, etc.).
Finally, save the file and restart the system. Now, UXTR should start on boot.
At any time, you can check the UXTR status with:
$ supervisorctl status uxtr
uxtr RUNNING pid 10538, uptime 15:01:57
Suppose now we want to restart UXTR five minutes after midnight, every day.
The following crontab entry will do the job:
5 0 * * * /path/to/supervisorctl restart uxtr
As you can see, this solution is simple, effective, and portable across different Linux flavors.
Here, we’ve assumed a user called batman. In order to use a different user, only one file has to be changed:
- /etc/rc.local (see sidebar note for Fedora 18+)