Osiris
Contributor
- Joined
- Aug 15, 2013
- Messages
- 148
How to install owncloud client in a freenas 10.3 jail
Actually : FreeBSD owncloud_client 10.3-STABLE FreeBSD 10.3-STABLE #0 r295946+0ea9076(9.10-STABLE): Mon Oct 3 06:51:23 UTC 2016
Actually : FreeBSD owncloud_client 10.3-STABLE FreeBSD 10.3-STABLE #0 r295946+0ea9076(9.10-STABLE): Mon Oct 3 06:51:23 UTC 2016
- Set up a standard jail via the freenas gui (here named owncloud_client)
- shell into it
jexec -u root owncloud_client csh
- install package owncloudclient.
You could compile it from source, using port /usr/ports/deskutils/owncloudclient/, but this is an enormous process due to tons of dependencies.
Not kidding - took a full day! - so witched to the pkg.
pkg install owncloudclient-2.2.4
You might need topkg update
first.
Version might change in the meantime, so dopkg search owncloudclient
to get the latest package.
- Then (or done before), setup a user on your owncloud server.
In my example
user: share
password: sharepass
server: http://cloud-server.local
local share in the jail: /mnt/share
- Preparation for a cron script ...
I've used bash so install bash first, if you want to copy mine
pkg install bash
Create a symlink (not necessary if you change it in the script, but I'm staying linux compliant)
ln -s /usr/local/bin/bash /bin/bash
- Create a cron entry using crontab -e in the jail. This works since Freenas v9.10 (I think. Before I had to create cronjobs on the host).
Code:* * * * * /mnt/owncloud_share.sh
- The cron script that runs every minute, as configured above.
I can't take all the credit, but made proper adaptations for freebsd.
vi /mnt/owncloud_share.sh
Code:#!/bin/bash SCRIPTNAME=`basename $0` PIDFILE=/tmp/${SCRIPTNAME}.pid if [ -f ${PIDFILE} ]; then OLDPID=`cat ${PIDFILE}` if [ "$OLDPID" == "" ]; then OLDPID="no_old_pid" fi RESULT=`ps auxww | grep ${OLDPID} | grep ${SCRIPTNAME}` if [ -n "${RESULT}" ]; then echo "Script already running! Exiting" exit 255 fi fi #grab pid of this process and update the pid file with it PID=`ps auxww | grep ${SCRIPTNAME} | head -n1 | awk ' {print $2;} '` echo ${PID} > ${PIDFILE} /usr/local/bin/owncloudcmd --trust --silent --non-interactive --user share --password sharepass /mnt/share http://cloud-server.local if [ -f ${PIDFILE} ]; then rm -f ${PIDFILE} fi
Last edited: