Page 1 of 1

[Tutorial] Auto Update

PostPosted: Tue Mar 26, 2013 3:04 am
by daneren2005
So hakko updates too fast. So I made a little auto update script and threw it in a daily cron job and decided to share. If hakko has an easy way to grab the current/latest version and compare them then I can modify the script :D

Code: Select all
wget http://dilerium.se/musiccabinet/subsonic-installer-standalone.zip -O /tmp/subsonic-installer-standalone.zip
unzip /tmp/subsonic-installer-standalone.zip -d /tmp/
service musiccabinet stop
mv /tmp/subsonic-installer-standalone/subsonic*.war /usr/share/musiccabinet/subsonic-main.war
mv /tmp/subsonic-installer-standalone/subsonic*.jar /usr/share/musiccabinet/subsonic-booter.jar
rm -R /tmp/subsonic-installer-standalone /tmp/subsonic-installer-standalone.zip
service musiccabinet start


PS: I use *.war/*.jar because in the only two updates I have grabbed so far the names have been different.

Re: [Tutorial] Auto Update

PostPosted: Wed Apr 03, 2013 6:22 pm
by kingmos
Here's my attempt. It's for FreeBSD with tomcat though.

Code: Select all
#!/usr/local/bin/bash

URL=http://dilerium.se/musiccabinet/subsonic-tomcat.war
file1=subsonic-tomcat.war
file2=/usr/local/apache-tomcat-6.0/webapps/ROOT.war

#Check for newer file on server
wget -N $URL

file1time=`stat -f "%Sm" -t %s $file1`
file2time=`stat -f "%Sm" -t %s $file2`

#compare files timestamps
if [ $file1time -gt $file2time ];
then

#Update
echo updating, newer version downloaded
/usr/local/etc/rc.d/tomcat6 stop
rm $file2
cp -a $file1 $file2
/usr/local/etc/rc.d/tomcat6 start
else

#Don't update
echo nothing to do, up to date
fi