slitaz-forge view pangolin/pangolin @ rev 411

pangolin: add up-forum
author Christophe Lincoln <pankso@slitaz.org>
date Wed Jan 15 10:16:34 2014 +0100 (2014-01-15)
parents c1250f344faf
children 14f50bbc616d
line source
1 #!/bin/sh
2 #
3 # Pangolin admin utility
4 #
5 # Copyright (C) 2012 SliTaz GNU/Linux - BSD License
6 #
7 # Authors : Christophe Lincoln <pankso@slitaz.org>
8 #
10 REPOS="/home/slitaz/repos"
11 WWW="/home/vhost"
12 WEBSITE="$WWW/www.slitaz.org/website"
13 PYTHON_LIB="/usr/lib/python2.5"
14 HGUSERS="/home/slitaz/auth/hgusers"
16 usage() {
17 cat << EOT
19 Usage: $(basename $0) [command]
20 Commands:
21 up-www Update website www.slitaz.org
22 up-forum Update forum.slitaz.org theme
23 up-hg Update Hg web interface hg.slitaz.org
24 adduser Add a user to Hg.
25 stats Display some server stats.
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-forum)
37 # Update forum.slitaz.org theme
38 echo "Updating: forum.slitaz.org..."
39 cd ${REPOS}/slitaz-forge && hg up
40 cp -a forum/my-templates ${WWW}/forum.slitaz.org/public_html ;;
41 up-hg)
42 # Update hg.slitaz.org template.
43 echo -e "\nUpdating Mercurial template..."
44 cd $REPOS/slitaz-dev-tools && hg update
45 cp -a slitaz-mercurial-style/* $PYTHON_LIB/site-packages/mercurial
46 chown -R root.root $PYTHON_LIB/site-packages/mercurial/templates
47 echo "" ;;
48 adduser)
49 [ ! "$2" ] && echo "Missing user name arg" && exit 0
50 [ ! "$3" ] && echo "Missing password arg" && exit 0
51 htpasswd -b $HGUSERS $2 $3 ;;
52 stats)
53 # Echo some stats.
54 echo "======== Disk usage ============="
55 df -h | grep ^/dev
56 echo "======== Memory usage ==========="
57 free -m | grep ^Mem
58 echo "======== Connected users ========"
59 who
60 echo "" ;;
61 backup)
62 echo "TODO: backup MySQL, SCN files, etc" ;;
63 *)
64 usage ;;
65 esac
66 exit 0