I recently wanted to install Wuala on my brand new media center PC running Ubuntu on it. It was not that hard because there is an excellent tutorial on how to setup wuala on a headless machine.
Unfortunately there was no script to start and stop Wuala on system start-up and shutdown. So I decided to create one.
#!/bin/bash #!/bin/bash ### BEGIN INIT INFO # Provides: wuala # Required-Start: $network $local_fs $remote_fs # Required-Stop: $network $local_fs $remote_fs # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: start Wuala headless (wuala) ### END INIT INFO WUALADIR=/home/wuala WUALAUSR=wuala WUALALOG=$WUALADIR/out.log WUALAERR=$WUALADIR/error.log uptest(){ if ps -u $WUALAUSR u|grep -v grep|grep loader3.jar >/dev/null;then echo "Wuala is running" return 0 else echo "Wuala is not running" return 1 fi } case "${1:-''}" in 'start') # start commands here echo "Starting Wuala..." uptest || su $WUALAUSR -c "wualacmd > $WUALALOG 2> $WUALAERR &" ;; 'stop') # stop commands here echo "Stopping Wuala..." uptest && su $WUALAUSR -c "wualacmd exit > $WUALALOG 2> $WUALAERR" ;; 'restart') # restart commands here $0 stop sleep 1 $0 start ;; 'status') # status commands here uptest && su $WUALAUSR -c "wualacmd showStatus" uptest && su $WUALAUSR -c "wualacmd connectionInfo" uptest && su $WUALAUSR -c "wualacmd showSettings" ;; *) # no parameter specified echo "Usage: $SELF start|stop|restart|status" exit 1 ;; esac |
It is a very early version with not much error checking, so use it at your own risk. I just posted it in case somebody might find it useful.
To use it just save the content to /etc/init.d/wuala and run
$ sudo update-rc.d wuala defaults |
Update: Added the necessary LSB informations
Update 2: The file can now be downloaded: /etc/init.d/wuala.
Upadte 3: Use wualacmd instead of wuala. (Thanks to http://www.synergeek.fr/2010/06/wuala-sous-linux/ for the hint)
Upadte 4: The new version checks if wuala is already running for the given user.

Cool
Thanks for sharing your ideas, I couldn’t find a similar script.
Seems to be exactly what I was looking after. Could you just provide a bit more explanations on how to use your script since I am quite novice in Ubuntu.
I understand I need to create a wuala account on my ubuntu box.
Then I need to insert your script into the boot thing /etc/init.d
Then I’m not too sure.
I obtain the following error msg:
sudo update-rc.d wuala defaults
update-rc.d: warning: /etc/init.d/wuala missing LSB information
update-rc.d: see
Normal?
Does Wuala starts completely automatically when configured this way?
How can I interact with it?
Many thanks in advance for your responses
Tugdual
I added the necessary LSB information. If you want to learn more about LSB and how it’s used in Ubuntu and Debian you can take a look here: http://wiki.debian.org/LSBInitScripts
I hope this helps.
Regards
Pascal
@Tugdualenligne the information you are looking for (unless you’ve already found it) is right here:
http://www.wuala.com/blog/2009/03/effective-usage-running-wuala-on-debian.html
good luck!
[...] rc.d Script for Archlinux Recently I published an init.d script for debian/ubuntu to start wuala in headless mode. Since some time now I have a mediacenter running on Archlinux so [...]
[...] est possible de de créer un script de démarrage automatique de Wuala. je me suis inspiré de http://pascal.nextrem.ch/2009/10/20/wuala-init-d-script/. Ce script appellera « /opt/wuala/wualacmd » et non plus [...]
[...] of this posting: How to make Wuala run on a headless server. The solution was found here and here. I used the latter. Works as advertised and starts up nicely in the background via [...]
Thanks for the script, I edited it a little, my version has some error handling. The original script wil start wuala on a status or stop command if it is not already running.
#!/bin/bash
### BEGIN INIT INFO
# Provides: wuala
# Required-Start: $network $local_fs $remote_fs
# Required-Stop: $network $local_fs $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: start Wuala headless (wuala)
### END INIT INFO
WUALAUSR=froh
wualacmd=/usr/bin/wualacmd
uptest(){
if ps aux|grep -v grep|grep loader3.jar >/dev/null;then
echo "Wuala is running"
return 0
else
echo "Wuala is not running"
return 1
fi
}
case "${1:-''}" in
'start')
# start commands here
echo "Starting Wuala..."
uptest || su $WUALAUSR -c "$wualacmd" &
uptest
;;
'stop')
# stop commands here
echo "Stopping Wuala..."
uptest && su $WUALAUSR -c "$wualacmd exit"
;;
'restart')
# restart commands here
su $WUALAUSR -c "$wualacmd restart" &
;;
'status')
# status commands here
cd $WUALADIR
uptest && su $WUALAUSR -c "$wualacmd showStatus"
uptest && su $WUALAUSR -c "$wualacmd connectionInfo"
uptest && su $WUALAUSR -c "$wualacmd showSettings"
;;
*)
# no parameter specified
echo "Usage: $SELF start|stop|restart|status"
exit 1
;;
esac
Thanks nice enhancement.
[...] http://pascal.nextrem.ch/2009/10/20/wuala-init-d-script/ Amedee's blog [...]
I was frustrated by the 100gb limit, and also wanted a way to control wuala via the service. So using the same basic principles I wrote a new script. I now have a ubuntu based server that trades about 800gb of storage–don’t worry, I have an internet connection that can handle it.
It includes the ability to manage multiple instances of wuala, and also to pass a command wuala as one or more users. It took most of the leg work out of configuring and starting wuala.
I think its fairly well commented, but if you have any questions just reply, I’ll probably be checking here. (and sorry for cutting in Pascal, I love your work, but I just wanted to share this.)
#! /bin/bash ### BEGIN INIT INFO # Provides: Wuala 1tb system # Required-Start: $network $local_fs $remote_fs # Required-Stop: $network $local_fs $remote_fs # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: extensible wuala daemon (extwualad) ### END INIT INFO ##config info #wuala users... wualausrs="wuala0 wuala1 wuala2 wuala3 wuala4 wuala5 wuala6 wuala7 wuala8 wuala9" #location of wuala cmd. $usr variable is allowed. wualadir="/usr/bin/wuala/" ##end config info uptest() { #checks if wuala is running for input user. outputs either verbosely or as an exit status. if (ps -f -u "$1"|grep loader3.jar|grep -v grep>/dev/null) #if wuala is in users processes then [ "$2" = "verbose" ] && echo "$1 - Up" return 0 else [ "$2" = "verbose" ] && echo "$1 - Down" return 1 fi } running() { #displays running instances in list form #clear variables run= norun= for usr in $wualausrs do uptest $usr && run="$run$usr " || norun="$norun$usr " #uptest and output to each list done if [ "$1" = "not" ] #return run or norun list based on arg then echo $norun else echo $run fi } start() { [ -p /dev/fd/0 ] && read data || data="$@" echo "starting wuala ..." #check for log dir [ -d /var/log/wuala/start ] || mkdir -p /var/log/wuala/start #start each user and write log files. for usr in $data do #check for wuala directory used by defaut (comment this out if unneeded [ -d ~$usr/wuala ] || mkdir ~$usr/wuala su -c "cd $wualadir; ./wualacmd&" $usr >> /var/log/wuala/start/$(date +%Y%m%d).$usr.log 2>>/var/log/wuala/start/$(date +%Y%m%d).$usr.err.log done for usr in $data do #wait for each one to exit and display uptest while ( ! uptest $usr) do sleep 1 done uptest $usr verbose done } stop() { [ -p /dev/fd/0 ] && read data || data="$@" #read from pipe if avail echo "stopping wuala ..." [ -d /var/log/wuala/stop ] || mkdir -p /var/log/wuala/stop #check for logdir #stop each usr and write log files. for usr in $data do #check for wuala directory used by defaut (comment this out if unneeded [ -d ~$usr/wuala ] || mkdir ~$usr/wuala su -c "cd $wualadir; ./wualacmd exit&" $usr >> /var/log/wuala/stop/$(date +%Y%m%d).$usr.log 2>>/var/log/wuala/stop/$(date +%Y%m%d).$usr.err.log done #then wait for each one to exit/display uptest for usr in $data do while (uptest $usr) do sleep 1 done uptest $usr verbose done } status(){ [ -p /dev/fd/0 ] && read data || data="$@" #read from pipe if avail for usr in $data do uptest $usr verbose #verbose uptest done } cleanup() { oldlogs=$(find /var/log/wuala -mtime +30 -iname *.log) for file in $oldlogs do rm "$file" done } cleanup #clean up old log files (older than 30 days) #next, case statements... case "$1" in start) case "$2" in all) #starts all wuala instances start "$wualausrs" ;; "") #DEFAULT starts all not running instances running not|start ;; *) #wildcard for starting as specific users start "$2" ;; esac ;; stop) case "$2" in all) stop "$wualausrs" ;; "") running|stop ;; *) stop "$2" ;; esac ;; restart|reload|force-reload) case "$2" in all) #runs exit on all users wuala instances (whether or not they were originally running) and then starts all wuala instances. stop "$wualausrs" start "$wualausrs" ;; "") #DEFAULT stops running wuala instances and starts all wuala instances (to save time) running|stop start "$wualausrs" ;; *) #wildcard for requesting specific users stop "$2" start "$2" ;; esac ;; status) case "$2" in running) #status of all running wuala instances status "$(running)" ;; "") #status of all wualausrs instances status "$wualausrs" ;; *) #wildcard for requesting specific users status "$2" ;; esac ;; [Pp]ass) #pass commands to one or more wuala instances. for usr in $([ "$2" = "all" ] && echo $wualausrs || echo "$2" ) #if user is "all" then it does this for all users in $wualausrs do args=$(echo "$@"|sed "s/$1 $2 //") #extract arguments echo "$usr $args" su -c "cd $wualadir; ./wualacmd $args" $usr|grep -v "Running on console"|grep -v "/usr/bin/java"|grep -v "Loader 3 version" #do commands for each user done ;; *) echo "Usage: /etc/init.d/wualad {start|stop|reload|force-reload|restart|status|pass}" status "$wualausrs" exit 1 ;; esacdo comment out the code for creating the ~$usr/wuala It doesnt work properly for some reason. it works if you substitute in the username, just not as is. (I’ve tried using “”) sorry for spamming up your comments, I hope its useful enough to warrant it.
Thanks for your script. I was working on a similar script handling multiple users but never finished it. Great addition.
I’ve had it running for a couple of days now, and I think i’ve stretched my low-end server system to the limit. I’ve had one system freezeup. I may extend the script further to manage the number of instances based on server load, but that is just something to watch out for. Wuala as we all know is java based, and java has been and will always be bloated. so, if all of your wuala instances decide to start downloading other users encrypted data, their memory usage will skyrocket. and this causes a whole slew of issues.
Thanks for some nice scripts. Came in handy when I had to dig out some old hardware and put together a dedicated wuala server using debian (6.0.x). If anyone needs a reference the hardware is an old compaq 433Mhz with 3xxMB RAM and 2x100GB HD. I did a fast and dirty server installation from the first debian CD. I regret I did not chose LVM configurations on the disks.
I got wuala running with the help of the effective-usage-running-wuala-on-debian. Notice that wuala has a deb package on their download site for you. Install it with
dpkg -i filename.Now to the scripts.
This construct in the start (and possibly stop) function(s) needs a timeout.
while ( ! uptest $usr)
do
In the start case the uptest always return false (I don’t know why. Looks like ps don’t return the expected result before you get a logon shell/prompt).
My modification
let "count=0"
while ( ! uptest $usr && [ $count -lt 2 ] )
let "$count += 1"
do
..:o)