Skip to Main Content

Oracle Database Express Edition (XE)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Howto: mount XE WebDAV to OS file system

jariolaFeb 14 2010
Hi,

I did write small bash script tot mount XE WebDAV folder to server file system.
This is tested on Ubuntu 8.04 server and depend package davfs2

Create file called xewebdav to /etc/init.d/
Like
sudo nano /etc/init.d/xewebdav
copy paste below code to file
#!/bin/bash
# Mount and unmount Oracle XE WebDAV folder to file system
# Tested on Ubuntu 8.04.4
# 
# Depend davfs2 package
# http://savannah.nongnu.org/projects/davfs2
# 
#	
# Author: 	Jari Laine
# Organization:	http://dbswh.com
#
# Change log:
#		Jla 03.02.2010	- Created
#
#
# Variables:
WEBDAV_SOURCE=http://localhost:8080;
WEBDAV_DESTIN=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/webdav;
WEBDAV_PERMIS=770;

ORA_VERSION="Oracle XE";
ORA_OS_USER="oracle";
ORA_OS_GROUP="dba";


start() {
        if( mount | grep $WEBDAV_SOURCE > /dev/null 2>&1 );
        then
                echo ""
                echo "$ORA_VERSION WebDAV is mounted already! "
        else
                echo ""
                echo -n "Mount $ORA_VERSION WebDAV ...  "
                mount -t davfs -o uid=$ORA_OS_USER,gid=$ORA_OS_GROUP,file_mode=$WEBDAV_PERMIS $WEBDAV_SOURCE $WEBDAV_DESTIN > /dev/null 2>&1
                sleep 3
		if( ! mount | grep $WEBDAV_SOURCE > /dev/null 2>&1 );
		then
			echo "Failed! "
		else
	                echo "OK."
			echo "$ORA_VERSION WebDAV is mounted to: "
        	        echo $WEBDAV_DESTIN
		fi
        fi
}
stop() {
        if( mount | grep $WEBDAV_SOURCE > /dev/null 2>&1 );
        then
                echo ""
                echo -n "Unmount $ORA_VERSION WebDAV ... "
                umount $WEBDAV_SOURCE > /dev/null 2>&1
                sleep 3
		if( mount | grep $WEBDAV_SOURCE > /dev/null 2>&1 );
		then
			echo "Failed! "
		else
			echo "OK. "
		fi
        else
                echo ""
                echo "$ORA_VERSION WebDAV is not mounted! "
        fi
}
status() {
        if( mount | grep $WEBDAV_SOURCE > /dev/null 2>&1 );
        then
                echo ""
                echo "$ORA_VERSION WebDAV is mounted to: "
                echo $WEBDAV_DESTIN
        else
                echo ""
                echo "$ORA_VERSION WebDAV is not mounted. "
        fi
}

if [ "$(id -u)" -ne "0" ];
then
        echo "You need to be root! "
        exit 1
fi

if( ! dpkg --get-selections | grep davfs2 > /dev/null 2>&1 );
then
	echo ""
	echo "To use this script mandatory package 'davfs2' need to be installed! "
	echo "You can install it by typing: sudo apt-get install davfs2 "
	exit
fi

if [ ! -d $WEBDAV_DESTIN ];
then
	echo ""
	echo "Directory $WEBDAV_DESTIN not exists! "
	exit
fi

# See how we were called.
case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  restart)
        stop
        start
        ;;
  status)
        status
        ;;
  *)
        echo $"Usage: xewebdav {start|stop|restart|status}"
        exit
esac
Give execute permission to file
sudo chmod +x /etc/init.d/xewebdav
Create folder webdav to /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/
sudo mkdir /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/webdav
Change permissions
sudo chown oracle:dba /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/webdav
Install davfs2 if not installed
sudo apt-get install davfs2
Edit file /etc/davfs2/secrets
sudo nano /etc/davfs2/secrets
add line to file (change your_system_password what is your system password)
http://localhost:8080   system  your_system_password
then you are ready to start using script
sudo /etc/init.d/xewebdav start
Hope this helps someone.

Please post comments

Br,Jari
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 14 2010
Added on Feb 14 2010
0 comments
1,735 views