Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- # chkconfig: 2345 95 5
- # description: Virtual OpenCL (VCL) is a cluster platform that allows OpenCL applications
- # : to transparently utilize many devices in a cluster, as if all the devices
- # : are on the local computer.
- #
- # vcl Script to stop/start VCL
- #
- # Author: epixoip
- # Original: Amnon Shiloh
- ### BEGIN INIT INFO
- # Provides: VCL
- # Required-Start: $network
- # Should-Start:
- # Required-Stop:
- # Should-Stop:
- # Default-Start: 2 3 4 5
- # Default-Stop: 0 1 6
- # Short-Description: VCL
- # Description: VCL - Virtual OpenCL for combining the power of many remote GPUs
- ### END INIT INFO
- #
- check_retval()
- {
- if test "$?" -eq 0; then
- echo ' Ok.'
- else
- echo ' Failed!'
- fi
- }
- check_proc()
- {
- pidof $1 >/dev/null
- return $?
- }
- kill_proc()
- {
- if check_proc $1; then
- killall $1
- sleep 1
- if check_proc $1; then
- killall -9 $1
- sleep 2
- if check_proc $1; then
- return 1
- else
- return 0
- fi
- else
- return 0
- fi
- else
- return 0
- fi
- }
- stop_host()
- {
- printf ' Killing broker: '
- kill_proc /sbin/broker
- check_retval
- }
- stop_backend()
- {
- printf ' Killing opencld: '
- kill_proc /sbin/opencld
- check_retval
- }
- start_host()
- {
- test -e /etc/vcl/is_host || return 0
- printf ' Starting broker: '
- if check_proc /sbin/broker; then
- echo ' already running.'
- return 1
- fi
- if test -e /etc/vcl/nodes; then
- args='-f/etc/vcl/nodes'
- else
- echo 'No compute nodes defined, will use only localhost!'
- args='-llocalhost'
- fi
- /sbin/broker $args
- check_retval
- }
- start_backend()
- {
- test -e /etc/vcl/is_back_end || return 0
- printf ' Starting opencld: '
- if check_proc /sbin/opencld; then
- echo ' already running.'
- return 1
- fi
- /sbin/opencld
- check_retval
- }
- case "$1" in
- start)
- echo 'Starting VCL...'
- start_host
- start_backend
- ;;
- stop)
- echo 'Stopping VCL...'
- stop_host
- stop_backend
- ;;
- status)
- if check_proc /sbin/broker; then
- echo 'broker is running.'
- else
- echo 'broker is not running.'
- fi
- if check_proc /sbin/opencld; then
- echo 'opencld is running.'
- else
- echo 'opencld is not running.'
- fi
- ;;
- restart|reload)
- echo 'Restarting VCL...'
- stop_host
- stop_backend
- start_host
- start_backend
- ;;
- esac
Add Comment
Please, Sign In to add comment