Commit 9beee10d authored by Reto Da Forno's avatar Reto Da Forno

minor adjustments

parent 38e4d9f4
......@@ -195,7 +195,7 @@ def main(argv):
# Use pigz instead of gz because pigz makes use of multiple processors.
gzcmd = ['pigz', '-p', max_cpus]
outfile = open(archivepath, 'w+')
logger.debug("Starting to write archive %s using max %s CPUs and nice level %d for compressing..."%(archivepath, max_cpus, nice_level))
logger.debug("Starting to write archive %s using max %s CPUs and level %d for compressing..."%(archivepath, max_cpus, nice_level))
ptar = subprocess.Popen(tarcmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True, preexec_fn=lambda : os.nice(nice_level))
pgz = subprocess.Popen(gzcmd, stdin=ptar.stdout, stdout=outfile, stderr=subprocess.PIPE, universal_newlines=True, preexec_fn=lambda : os.nice(nice_level))
gzout, gzerr = pgz.communicate()
......
......@@ -6,14 +6,11 @@
* __version__ = "$Revision: 1296 $"
* __date__ = "$Date: 2011-08-12 17:06:17 +0200 (Fri, 12 Aug 2011) $"
* __id__ = "$Id: newtest.php 1296 2011-08-12 15:06:17Z walserc $"
* __source__ = "$URL: svn://svn.ee.ethz.ch/flocklab/trunk/server/webserver/user/newtest.php $"
*/
?>
<?php
$dir="../../flocklab_downloads/";
$dir="/home/flocklab/flocklab_downloads/";
$subfolder="flooja";
// check svn ..
exec('svn up '.$dir.$subfolder);
// make sure the directory exists
exec('cd '.$dir, $output, $retval);
......
......@@ -968,7 +968,7 @@ function update_add_test($xml_config, &$errors, $existing_test_id = NULL, $abort
if (preg_match ('/((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])/' , $_SERVER['REMOTE_ADDR'])) // we do not support ipv6 on our backend server
$sc->addChild('remoteIp', $_SERVER['REMOTE_ADDR']);
else {
array_push($errors, '&lt;remoteIp&gt;: FlockLab does not support IPv6 addresses ('.$_SERVER['REMOTE_ADDR'].'). To use the <a href="https://www.flocklab.ethz.ch/wiki/wiki/Public/Man/Tutorials/Tutorial2#notes">Serial socket feature</a>, please provide an IPv4 address.');
array_push($errors, 'remoteIp: FlockLab does not support IPv6 addresses ('.$_SERVER['REMOTE_ADDR'].'). To use the <a href="https://www.flocklab.ethz.ch/wiki/wiki/Public/Man/Tutorials/Tutorial2#notes">Serial socket feature</a>, please provide an IPv4 address.');
}
}
}
......
......@@ -10,9 +10,7 @@
*/
?>
<?php
$dir="../../flocklab_downloads/platform-support/tinyos-2.x/";
// check svn ..
exec('svn up '.$dir);
$dir="/home/flocklab/flocklab_downloads/platform-support/tinyos-2.x/";
// make sure the directory exists
exec('cd '.$dir, $output, $retval);
......@@ -24,6 +22,6 @@ if ($retval != 0) {
// create tar.gz
header('Content-Type: application/x-gzip');
header('Content-Disposition: attachment; filename="flocklab_tinyos.tar.gz"');
passthru('cd '.$dir.';tar --exclude="*.svn" -czvf - ./');
passthru('cd '.$dir.';tar -czvf - ./');
?>
......@@ -10,20 +10,15 @@
*/
?>
<?php
$dir="../../flocklab_downloads/shell-tool/";
// check svn ..
exec('svn up '.$dir);
$path="/home/flocklab/flocklab_downloads/shell-tool/";
$filename="flocklab";
// make sure the directory exists
exec('cd '.$dir, $output, $retval);
if ($retval != 0) {
echo "error code $retval";
// make sure the file exists
if (!file_exists($path.$filename)) {
echo "file not found";
exit(1);
}
// create tar.gz
// header('Content-Type: application/x-gzip');
header('Content-Disposition: attachment; filename="flocklab_tool.tar.gz"');
passthru('cd '.$dir.';tar --exclude="*.svn" -czvf - ./');
passthru('cd '.$path.'; tar -czvf - '.$filename);
?>
#!/bin/bash
#
# Fetches the results of a FlockLab test.
# Usage:
# ./fetchtest.sh [test_id]
#
# This script requires a webdav client (e.g. cadaver)
# Store your FlockLab login credentials in the file .netrc in your home directory as follows:
# default
# login [your_username]
# password [your_password]
dav_site='https://www.flocklab.ethz.ch/user/webdav'
dav_client=/usr/bin/cadaver
scratch=/tmp/flocklab_tmp
maxtime=3600
fail=0
if [ $# -eq 1 ]
then
if [ ! -d $scratch ]
then
mkdir $scratch
fi
if [ ! -d $scratch/$1 ]
then
mkdir $scratch/$1
fi
mkdir /tmp/$1
starttime=`date +%s`
duration=$((`date +%s` - $starttime))
while [ $duration -lt $maxtime ]
do
$dav_client 1> $scratch/$1/dav.log 2> $scratch/$1/dav.err <<EOF
open $dav_site
get $1/testconfiguration.xml /tmp/$1/testconfiguration.xml
get $1/results_nopower.tar.gz $scratch/$1/results.tar.gz
exit
EOF
cat $scratch/$1/dav.log
cat $scratch/$1/dav.err
if [ `sed '/^\(404\|500\)/!d' $scratch/$1/dav.log | wc -l` -gt 0 ]
then
echo "error occured while fetching data"
fail=1
sleep 120
duration=$((`date +%s` - $starttime))
else
fail=0
duration=$maxtime
fi
rm $scratch/$1/dav.log $scratch/$1/dav.err
done
if [ $fail -eq 1 ]
then
rm $scratch/$1/results.tar.gz
rmdir $scratch/$1
rmdir --ignore-fail-on-non-empty $scratch
echo "timeout when downloading test data"
exit 1
fi
path=`pwd`
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd /tmp/
tar --exclude='results_test_*_powerprofiling.csv' -xvzf $scratch/$1/results.tar.gz
echo "Downloaded data to $PWD/$1"
# clean up
rm $scratch/$1/results.tar.gz
rmdir $scratch/$1
rmdir --ignore-fail-on-non-empty $scratch
cd $path
else
echo "please specify a test ID"
fi
......@@ -21,10 +21,11 @@
# If you want to be able to download your test results via webdav (-f), you need to install the client 'cadaver'.
# ------------------------------
DEST=/tmp
EXTRACT=0
DEST=/tmp # destination directory
EXTRACT=0 # extract results?
TESTCONFIG=0 # also download XML test config?
SERVER_URL=https://www.flocklab.ethz.ch/user
CURL_PARAMS=-sS
CURL_PARAMS='-sS -4'
FLAUTH_FILE=.flocklabauth
NETRC_FILE=$HOME/.netrc
DAV_URL=https://www.flocklab.ethz.ch/user/webdav
......@@ -119,6 +120,10 @@ EOF
rm $DEST/$TESTID/$TESTID.tar.gz
fi
fi
if [ $TESTCONFIG -eq 0 ]
then
rm $DEST/$TESTID/testconfiguration.xml
fi
rm $DEST/$TESTID/dav.log
fi
}
......@@ -237,6 +242,16 @@ do
rm $OUTFILE
fi
fi
if [ $TESTCONFIG -gt 0 ]
then
if [ $EXTRACT -gt 0 ]
then
OUTFILE=$DEST/$OPTARG/testconfiguration.xml
else
OUTFILE=$DEST/${OPTARG}_config.xml
fi
RESPONSE=`curl -o - $CURL_PARAMS -X POST -H "Content-Type: application/x-www-form-urlencoded" -d "testid=${OPTARG}&query=get&username=${USER}&password=${PASSWORD}" $SERVER_URL/login.php -o $OUTFILE $SERVER_URL/testconfig_download.php`
fi
;;
f)
which $DAV_CLIENT >> /dev/null
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment