[Tutorial] Auto Update

Artist radio, genre radio & related artists. A Subsonic server for music nerds.

Moderator: moderators

[Tutorial] Auto Update

Postby daneren2005 » Tue Mar 26, 2013 3:04 am

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.
Developer of DSub for Android
daneren2005
 
Posts: 1709
Joined: Fri Jul 06, 2012 7:52 pm

Re: [Tutorial] Auto Update

Postby kingmos » Wed Apr 03, 2013 6:22 pm

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
kingmos
 
Posts: 13
Joined: Thu Oct 14, 2010 2:51 pm


Return to MusicCabinet

Who is online

Users browsing this forum: No registered users and 5 guests