Problem
I required Xvfb to be installed, and running as a service on a server.
Assumptions: you know how to use chkconfig, yum, vi and chmod.
Solution
You can now start your service with:
Check it's running:
Check it's listed to startup automatically for runlevels 2,3,4,5:
/etc/init.d/xvfbd
See also:
http://www.cyberciti.biz/tips/linux-write-sys-v-init-script-to-start-stop-service.html
I required Xvfb to be installed, and running as a service on a server.
Assumptions: you know how to use chkconfig, yum, vi and chmod.
Solution
yum install xorg-x11-server-Xvfb
vi /etc/init.d/xvfbd
(copy contents below into the file, and save it)chmod 755 /etc/init.d/xvfbd
(now we have a service)chkconfig --add xvfbd
chkconfig --level 2345 xvfbd on
You can now start your service with:
sudo service xvfbd start
Check it's running:
ps -ef | grep Xvfb
Check it's listed to startup automatically for runlevels 2,3,4,5:
chkconfig --list
/etc/init.d/xvfbd
#!/bin/bash
#
# description: Xvfb server
#
# Get function from functions library
. /etc/init.d/functions
# Start the service Xvfb
start() {
echo -n "Starting Xvfb server: "
/usr/bin/Xvfb &
### Create the lock file ###
touch /var/lock/subsys/Xvfb
success $"Xvfb server startup"
echo
}
# Restart the service Xvfb
stop() {
echo -n "Stopping Xvfb server: "
killproc Xvfb
### Now, delete the lock file ###
rm -f /var/lock/subsys/Xvfb
echo
}
### main logic ###
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status Xvfb
;;
restart|reload|condrestart)
stop
start
;;
*)
echo $"Usage: $0 {start|stop|restart|reload|status}"
exit 1
esac
exit 0
See also:
http://www.cyberciti.biz/tips/linux-write-sys-v-init-script-to-start-stop-service.html
[root@media ~]# chkconfig --add xvfbd
ReplyDeleteservice xvfbd does not support chkconfig
Starting Xvfb server: [ OK ]
[root@media ~]# (EE) AIGLX error: dlopen of /usr/lib/dri/swrastg_dri.so failed (/usr/lib/dri/swrastg_dri.so: cannot open shared object file: No such file or directory)
(EE) GLX: could not load software renderer
http://prefetch.net/blog/index.php/2007/04/01/making-rc-scripts-chkconfig-aware/
ReplyDeleteHello
ReplyDeleteWith Fedora 17 and Fedora 18, init.d has been replaced with systemd and service files.
How to adapt your script to make it compatible with this new method?