Question

I have installed open source version of virtuoso in my Ubuntu machine. The problem which i am facing is, i have to restart the virtuoso manually each time i restart my machine. Is there any way which allows my machine to start virtuoso automatically? Like , i have tomcat installed in another port, i don’t need to restart the Apache after restarting my machine. Does anyone know where can i make changes to fix this issue. Thanks

Was it helpful?

Solution

write a script like:

#!/bin/bash

sudo /usr/virtuoso-6.1.7/bin/virtuoso-t -fd +configfile /usr/virtuoso-6.1.7/bin/virtuoso.ini

(or any other configuration) save the script somewhere

enter the following into /etc/rc.local

openvt -s /path/to/your/script

after a restart this will automatically start your script in a new backround terminal (or what other term its called) usually after CTRL + ALT + F7 (your desktop) -> CTRL + ALT + F8

I hope I remembered this correctly and documented all steps (it's been a while).

Greetings

OTHER TIPS

it is necessary to handle start and also stop of virtuos a possible way: (as user running virtuoso) create bin folder in home of user that runs virtuoso and add following scripts

virtuosoStart.sh

DBDIR=/vol0/virtuosodb
VIRTUOSO_BIN=/opt/virtuoso7/bin/
export PATH=$VIRTUOSO_BIN:$PATH
cd $DBDIR
virtuoso-t

virtuosoStop.sh

#!/bin/bash
VIRTUOSO_BIN=/opt/virtuoso7/bin/
${VIRTUOSO_BIN}isql-v 1111 dba dba  -K

please change DBDIR and VIRTUOSO_BIN according to you environment

(as root, "sudo su" or add sudo before every command ) Now is necessary to make script that accept start and stop parameter in folder /etc/init.d .

cp skeleton virtuoso
chmod a+x virtuoso

you can delet eunnecessary functions and implement start stop and status operation following way:

DESC="virtuoso server"
NAME=virtuoso
DAEMON=/opt/virtuoso7/bin/virtuoso-t
# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0
DBDIR=/vol0/virtuosodb
PIDFILE=${DBDIR}/virtuoso.lck
SCRIPTNAME=/etc/init.d/$NAME
USER=ubuntu
START_SCRIPT=/home/${USER}/bin/virtuosoStart.sh
STOP_SCRIPT=/home/${USER}/bin/virtuosoStop.sh

case "$1" in
 start)
    [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
    su -l $USER -c $START_SCRIPT
    case "$?" in
            0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
            2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
    esac
    ;;
stop)
    [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
    su -l $USER -c $STOP_SCRIPT
    case "$?" in
            0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
            2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
    esac
    ;;
status)
    if [ -f $PIDFILE ] && ps -p$(cut -d "=" -f 2 ${PIDFILE} ) > /dev/null;then
            log_success_msg "$NAME is running"
            exit 0
    else
            log_failure_msg "$name is not running"
            exit 1
    fi
   ;;
*)
    echo "Usage: $SCRIPTNAME {start|stop|status}" >&2
    exit 3
    ;;
esac

now is necessay to add links to the script to appropriate /etc/rc.x folders. You can do it manually or better way is by :

update-rc.d virtuoso defaults

hope it helps and good luck

btw: you can add check if the virtuoso is already running to the start part of the init script

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top