slitaz-forge rev 107

Add small utils for pangolin
author Christophe Lincoln <pankso@slitaz.org>
date Tue Mar 13 14:20:45 2012 +0100 (2012-03-13)
parents f163fd02e5ae
children 3f188d62df9b
files pangolin/pangolin
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/pangolin/pangolin	Tue Mar 13 14:20:45 2012 +0100
     1.3 @@ -0,0 +1,49 @@
     1.4 +#!/bin/sh
     1.5 +#
     1.6 +# Pangolin admin utility
     1.7 +#
     1.8 +# Copyright (C) 2012 SliTaz GNU/Linux - BSD License
     1.9 +#
    1.10 +# Authors : Christophe Lincoln <pankso@slitaz.org>
    1.11 +#
    1.12 +
    1.13 +REPOS="/home/slitaz/repos"
    1.14 +WWW="/home/slitaz/www"
    1.15 +WEBSITE="$WWW/website"
    1.16 +PYTHON_LIB="/usr/lib/python2.5"
    1.17 +
    1.18 +usage() {
    1.19 +	echo "\nUsage: $(basename $0) [command]
    1.20 +Commands:
    1.21 +  up-www       Update website http://www.slitaz.org/
    1.22 +  up-hg        Update Hg web interface http://hg.slitaz.org/
    1.23 +  stats        Display some server stats.
    1.24 +  backup       Backup MySQL DB and files\n"
    1.25 +}
    1.26 +
    1.27 +case "$1" in
    1.28 +	up-www)
    1.29 +		# Update website from repo.
    1.30 +		echo "Updating: www.slitaz.org..."
    1.31 +		cd $WEBSITE && hg pull -u ;;
    1.32 +	up-hg)
    1.33 +		# Update hg.slitaz.org template.
    1.34 +		echo -e "\nUpdating Mercurial template..."
    1.35 +		cd $REPOS/slitaz-dev-tools && hg update 
    1.36 +		cp -a slitaz-mercurial-style/* $PYTHON_LIB/site-packages/mercurial
    1.37 +		chown -R root.root $PYTHON_LIB/site-packages/mercurial/templates
    1.38 +		echo "" ;;
    1.39 +	stats)
    1.40 +		# Echo some stats.
    1.41 +		echo "======== Disk usage ============="
    1.42 +		df -h | grep ^/dev
    1.43 +		echo "======== Memory usage ==========="
    1.44 +		free -m | grep ^Mem
    1.45 +		echo "======== Connected users ========"
    1.46 +		who ;;
    1.47 +	backup)
    1.48 +		echo "TODO: backup MySQL, SCN files, etc" ;;
    1.49 +	*)
    1.50 +		usage ;;
    1.51 +esac
    1.52 +exit 0