slitaz-forge view chub/chub @ rev 134

chub: Try to fix RRD script
author Christophe Lincoln <pankso@slitaz.org>
date Thu Mar 15 05:18:50 2012 +0100 (2012-03-15)
parents 90f3032b61f2
children fec794d4852f
line source
1 #!/bin/sh
2 #
3 # Chub admin utility - SliTaz Community HUB aka Chub is the server hosting
4 # all end users sites such as the website, doc, forum as well as Hg repos.
5 # This tiny utility can be run by a cron job or via the command line for
6 # maintainance tasks.
7 #
8 # Copyright (C) 2012 SliTaz GNU/Linux - BSD License
9 #
10 # Authors : Christophe Lincoln <pankso@slitaz.org>
11 #
13 [ -f "/etc/slitaz/chub.conf" ] && . /etc/slitaz/chub.conf
14 [ -f "chub.conf" ] && . ./chub.conf
16 usage() {
17 cat << EOT
19 Usage: $(basename $0) [command]
21 Commands:
22 stats Display some server stats
23 up-www Update website http://www.slitaz.org/
24 up-chub Update Chub web interface http://chub.slitaz.org/
25 rrd Update RRD graphs images
26 backup Backup MySQL DB and files"
28 EOT
29 }
31 case "$1" in
32 up-www)
33 # Update website from repo.
34 echo "Updating: www.slitaz.org..."
35 cd $WEBSITE && hg pull -u ;;
36 up-chub)
37 # Update Chub web interface from repo.
38 echo "Updating: chub.slitaz.org..."
39 cd $REPOS/slitaz-forge
40 #hg update if repos are on Chub
41 hg pull -u
42 rm -rf $VHOST/*.* $VHOST/images/*.png
43 cp -a chub/web/* $VHOST ;;
44 stats)
45 # Echo some stats.
46 echo "======== Disk usage ============="
47 df -h | grep ^/dev
48 echo "======== Memory usage ==========="
49 free -m | grep ^Mem
50 echo "======== Connected users ========"
51 who ;;
52 rrd)
53 echo "Making RRD graphs images..."
54 $VHOST/lib/makegraphs >/dev/null ;;
55 backup)
56 echo "TODO: backup MySQL, SCN files, etc" ;;
57 *)
58 usage ;;
59 esac
60 exit 0