imip-agent

tools/init.sh

1037:e55229d8df6d
2016-01-31 Paul Boddie Added explanatory diagrams for scheduling functions to the resources page.
     1 #!/bin/sh     2      3 DIRNAME=`dirname $0`     4      5 if [ -e "$DIRNAME/config.sh" ]; then     6     . "$DIRNAME/config.sh"     7 else     8     . /etc/imip-agent/config.sh     9 fi    10     11 PROGNAME=`basename $0`    12     13 if [ "$1" = "--help" ]; then    14     cat 1>&2 <<EOF    15 Usage: $PROGNAME [ <stored data directory> [ <published data directory> [ <user> [ <group> ] ] ] ]    16     17 Initialise stored and published data directories either at any specified    18 locations or, respectively, at $INSTALL_DIR and $WEB_INSTALL_DIR.    19     20 Set permissions to the given user and group or, respectively, to $IMIP_AGENT_USER    21 and $IMIP_AGENT_GROUP.    22     23 Within the stored data directory (using $INSTALL_DIR as an example), the    24 following directories are created:    25     26   * $INSTALL_DIR/store    27   * $INSTALL_DIR/preferences    28     29 Within the published data directory (using $WEB_INSTALL_DIR as an example), the    30 following directory is created:    31     32   * $WEB_INSTALL_DIR/static    33 EOF    34     exit 1    35 fi    36     37 INSTALL_DIR=${1:-$INSTALL_DIR}    38 WEB_INSTALL_DIR=${2:-$WEB_INSTALL_DIR}    39 USER=${3:-$IMIP_AGENT_USER}    40 GROUP=${4:-$IMIP_AGENT_GROUP}    41     42 for DIR in "$INSTALL_DIR"/store "$INSTALL_DIR"/preferences "$WEB_INSTALL_DIR"/static ; do    43     mkdir -p "$DIR"    44     chown "$USER" "$DIR"    45     chgrp "$GROUP" "$DIR"    46     chmod g+ws "$DIR"    47 done