slitaz-forge rev 94

Add chub utility
author Christophe Lincoln <pankso@slitaz.org>
date Thu Mar 08 15:57:36 2012 +0100 (2012-03-08)
parents 18b19673ab1d
children e5121798f65a
files chub/chub
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/chub/chub	Thu Mar 08 15:57:36 2012 +0100
     1.3 @@ -0,0 +1,53 @@
     1.4 +#!/bin/sh
     1.5 +#
     1.6 +# Chub admin utility - SliTaz Community HUB aka Chub is the server hosting
     1.7 +# all end users sites such as the website, doc, forum as well as Hg repos.
     1.8 +# This tiny utility can be run by a cron job or via the command line for 
     1.9 +# maintainance tasks.
    1.10 +#
    1.11 +# Copyright (C) 2012 SliTaz GNU/Linux - BSD License
    1.12 +#
    1.13 +# Authors : Christophe Lincoln <pankso@slitaz.org>
    1.14 +#
    1.15 +
    1.16 +REPOS="/home/slitaz/repos"
    1.17 +WWW="/home/slitaz/www"
    1.18 +VHOST="$WWW/chub"
    1.19 +WEBSITE="$WWW/website"
    1.20 +
    1.21 +usage() {
    1.22 +	echo -e "\nUsage: `basename $0` [command]
    1.23 +Commands:
    1.24 +  up-www       Update website http://www.slitaz.org/
    1.25 +  up-chub      Update Chub web interface http://chub.slitaz.org/
    1.26 +  stats        Display some server stats.
    1.27 +  backup       Backup MySQL DB and files\n"
    1.28 +}
    1.29 +
    1.30 +case "$1" in
    1.31 +	up-www)
    1.32 +		# Update website from repo.
    1.33 +		echo -e "\nUpdating: www.slitaz.org..."
    1.34 +		cd $WEBSITE && hg pull -u
    1.35 +		echo "" ;;
    1.36 +	up-chub)
    1.37 +		# Update Chub web interface from repo.
    1.38 +		echo -e "\nUpdating: chub.slitaz.org..."
    1.39 +		cd $REPOS/slitaz-forge
    1.40 +		#hg update when repos will be on Chub
    1.41 +		hg pull -u
    1.42 +		cp -a chub/web/* $VHOST
    1.43 +		echo "" ;;
    1.44 +	stats)
    1.45 +		# Echo some stats
    1.46 +		echo -e "\n==== Disk usage ===="
    1.47 +		df -h | grep ^/dev
    1.48 +		echo "==== Connected users ===="
    1.49 +		who
    1.50 +		echo "" ;;
    1.51 +	backup)
    1.52 +		echo "TODO: backup MySQL, SCN files, etc" ;;
    1.53 +	*)
    1.54 +		usage ;;
    1.55 +esac
    1.56 +exit 0