bootchart/bootchart.sh

50 lines
1.1 KiB
Bash
Raw Normal View History

#!/bin/sh
#
# Bootchart shell script - use the web renderer for bootchart
#
# Copyright (c) 2006 by Stefano Cotta Ramusino <stefano.cotta@qilinux.it>
if [ $# -eq 0 ]; then
format="png"
output_dir="."
else
if [[ "$1" == "png" || "$1" == "svg" || "$1" == "eps" ]]; then
format=$1
else
echo "$0 : invalid format. Try: png, svg or eps"
exit 1
fi
if [[ -d "$2" ]]; then
output_dir=$2
else
echo "$0: output directory not found"
exit 1
fi
fi
bootchart_log="/var/log/bootchart.tgz"
webrenderer_url="http://render.bootchart.org:8080/bootchart/render"
if [ ! -f "$bootchart_log" ]; then
echo "$0: bootchart log not found."
echo "Try adding \`init=/sbin/bootchartd' to your kernel entries in grub configuration file"
exit 1
fi
if [ $format == "svg" ]; then
output_ext_file="svgz"
else
if [ $format == "eps" ]; then
output_ext_file="eps.gz"
else
output_ext_file=$format
fi
fi
curl \
--form format=$format \
--form log=@$bootchart_log \
$webrenderer_url > $output_dir/bootchart.$output_ext_file
exit $?