3 # Check running as root
4 if [ "$(whoami)" != "root" ]; then
5 (echo "Run $0 as root.") 1>&2
9 nconf=/usr/share/nginx/conf
10 # Generate the ssl cert, if necessary
11 if [ ! -d "$nconf" ]; then
12 echo "ssl cert not found at $nconf, generating..."
14 if [[ $? != 0 ]] ; then
15 (echo "gen_ssl_cert failed, exiting.") 1>&2
22 if [ ! -d "$nginx" ]; then
23 (echo "Install nginx.") 1>&2
29 echo "Copying nginx configs..."
30 cp -v nginx/fastcgi_params ./nginx/mime.types $nginx/
31 rm -fv $nginx/sites-enabled/*
32 cp -v nginx/sites-enabled/mctxconfig $nginx/sites-enabled
35 echo "Restarting nginx..."
36 /etc/init.d/nginx restart
39 echo "Note: Check the document root for the nginx config is set correctly."
42 rsyslog=/etc/rsyslog.d
43 lrotate=/etc/logrotate.d
44 if [ -d "$rsyslog" ]; then
46 echo "Copying rsyslog configs..."
47 cp -v rsyslog.d/30-mctxserv.conf $rsyslog/
50 echo "Restarting rsyslog..."
51 /etc/init.d/rsyslog restart
54 (echo "Could not find rsyslog at $rsyslog. Skipping.") 1>&2
57 if [ -d "$lrotate" ]; then
59 echo "Copying logrotate configs..."
60 cp -v logrotate.d/mctxserv.conf $lrotate/
63 (echo "Could not find logrotate at $lrotate. Skipping.") 1>&2