# UserScriptController0 Resource

This controller is responsible for handling user scripts. These user can be used by the provisoner to run on the created VMs.

### POST /user/v0.0/switch/provision/confscript

Security Roles Allowed
  ADMIN, USER

Request Body
media type | data type
--- | ---
text/xml | confScript (XML)

Response Body
media type | data type
--- | ---
application/json | string (JSON)
application/json | string (JSON)
application/xml | string (XML)

#### Example

##### Request

    POST /user/v0.0/switch/provision/confscript
    Content-Type: text/xml
    Accept: application/json

    <confScript>
      <script>#!/bin/bash\n\nlogstashScript=/root/runLogstash.sh\nscreen -S logstash -dm /bin/bash "$logstashScript"\n\n\nlogLevelPath=/root/\nlogLevelFile=$logLevelPath/logstash_loglevel.csv\nremotePath=/media/lobcder/skoulouz/\nremoteLogPath=$remotePath/logs\nlocalLogPath=/root/logs\n\nmkdir $localLogPath\n\n\nfor logArchPath in $remoteLogPath/*.gz; do\n  echo "File -&gt; $logArchPath"\n  if [ ! -f $logArchPath.lock ]; then\n    touch $logArchPath.lock\n    cp $logArchPath $localLogPath\n    logArchName=$(basename $logArchPath)\n    tar -xvf $localLogPath/$logArchName -C $localLogPath\n    sleep 120\n    modTime=-100\n    while [ ! -f $logLevelFile ]\n    do\n      sleep 5\n    done\n    while [ $modTime -lt 120 ]\n    do\n      moddate=$(stat -c %Y $logLevelFile)\n      moddate=${moddate%% *}\n      now=$(date +%s)\n      modTime="$(( $now - $moddate))"\n      echo $modTime\n      sleep 5\n    done\n    rm $localLogPath/*.tar.gz\n    rm $localLogPath/*.log\n    modTime=-100\n  fi\ndone\n    \n\nscreen -X -S logstash quit\nsleep 5\n\nuid=`ifconfig | grep eth0 | awk '{print $NF}' | sed 's/://g'`\n\nfor csvFiles in $logLevelPath/*.csv; do\n  echo $csvFiles $csvFiles$uid.csv\n  mv $csvFiles $csvFiles$uid.csv\n  cp $csvFiles$uid.csv $remotePath\ndone\n\nkillall java \n</script>
      <user>user</user>
      <pwd>123</pwd>
      <action>58c2c2f3a8d4b56889878d03</action>
    </confScript>

##### Response

    HTTP/1.1 201 Looks Good
    Content-Type: application/json

    ...