slitaz-forge view chub/chub @ rev 127

chub: Add custom rrdtool script and cron task
author Christophe Lincoln <pankso@slitaz.org>
date Thu Mar 15 04:27:09 2012 +0100 (2012-03-15)
parents eed946160be6
children 3897fc67dad5
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 REPOS="/home/slitaz/repos"
14 WWW="/home/slitaz/www"
15 VHOST="$WWW/chub"
16 WEBSITE="$WWW/website"
18 usage() {
19 echo "\nUsage: $(basename $0) [command]
20 Commands:
21 up-www Update website http://www.slitaz.org/
22 up-chub Update Chub web interface http://chub.slitaz.org/
23 stats Display some server stats.
24 backup Backup MySQL DB and files\n"
25 }
27 case "$1" in
28 up-www)
29 # Update website from repo.
30 echo "Updating: www.slitaz.org..."
31 cd $WEBSITE && hg pull -u ;;
32 up-chub)
33 # Update Chub web interface from repo.
34 echo "Updating: chub.slitaz.org..."
35 cd $REPOS/slitaz-forge
36 #hg update when repos will be on Chub
37 hg pull -u
38 rm -rf $VHOST/*.*
39 cp -a chub/web/* $VHOST ;;
40 stats)
41 # Echo some stats.
42 echo "======== Disk usage ============="
43 df -h | grep ^/dev
44 echo "======== Memory usage ==========="
45 free -m | grep ^Mem
46 echo "======== Connected users ========"
47 who ;;
48 backup)
49 echo "TODO: backup MySQL, SCN files, etc" ;;
50 *)
51 usage ;;
52 esac
53 exit 0