Commit b639eed0 authored by Runar Borge's avatar Runar Borge

Un-nest dependency to home directory

The current implementation uses hardcoded paths to bin and etc
located in $HOME/microdep/.   This commit removed this dependencies
by using relative paths to the script executed.
A s long as the folder structure is retained it will follow the relative path
to the correct include file
parent 4847070d
......@@ -2,7 +2,7 @@
# start measurement jobs if not running
export USER=$(whoami)
source $HOME/microdep/etc/start.cfg
source $(realpath $(dirname "${BASH_SOURCE[0]}")/../etc/start.cfg)
stop=no
if test $# -gt 0; then
......@@ -53,11 +53,11 @@ if ! pgrep -u $USER -f $root/bin/crude-ana >/dev/null; then
fi
if ! pgrep -u $USER -f $trace >/dev/null; then
$HOME/microdep/bin/start-trace.sh
$root/bin/start-trace.sh
fi
if ! pgrep -u $USER -f $tcptrace >/dev/null; then
$HOME/microdep/bin/start-tcptrace.sh
$root/bin/start-tcptrace.sh
fi
if ! pgrep -u $USER -f $vmstat >/dev/null; then
......@@ -65,6 +65,6 @@ if ! pgrep -u $USER -f $vmstat >/dev/null; then
fi
if ! pgrep -u root -f '/usr/sbin/tcpdump.* icmp' >/dev/null; then
$HOME/microdep/bin/start-icmp.sh &
$root/bin/start-icmp.sh &
fi
#!/bin/bash
# kill mp-rude measurements at midnight CET
source $HOME/microdep/etc/start.cfg
source $(realpath $(dirname "${BASH_SOURCE[0]}")/../etc/start.cfg)
T=$(env TZ=Europe/Oslo date +%T)
if test $T = "00:00:00"; then
......
#! /bin/sh
#! /bin/bash
set -e
......@@ -6,7 +6,7 @@ INDEX=$1
PIPE=$2
LOG=$3
. $HOME/microdep/etc/start.cfg
source $(realpath $(dirname "${BASH_SOURCE[0]}")/../etc/start.cfg)
if test -f "$LOG"; then
find "$LOG" -maxdepth 1 -mtime +5 -name '*.log' -type f -delete
......
#!/bin/sh
source $HOME/microdep/etc/start.cfg
source $(realpath $(dirname "${BASH_SOURCE[0]}")/../etc/start.cfg)
id=`ps xa | grep ntx7 | grep mapidump | awk '{print $1}'`
......
#!/bin/bash
source $HOME/microdep/etc/start.cfg
source $(realpath $(dirname "${BASH_SOURCE[0]}")/../etc/start.cfg)
> $logpath/$date/ntp.gz
......
#!/bin/bash
. $HOME/microdep/etc/start.cfg
source $(realpath $(dirname "${BASH_SOURCE[0]}")/../etc/start.cfg)
dato=`date +%F-%T`
......
#!/bin/bash
source $HOME/microdep/etc/start.cfg
source $(realpath $(dirname "${BASH_SOURCE[0]}")/../etc/start.cfg)
IF=`ip route get 158.38.62.1 | perl -ne 'print $1 if / dev (\w+) /'`
if test "$IF" != ""
......
#!/bin/bash
source $HOME/microdep/etc/start.cfg
tracetargets=`cat $HOME/microdep/etc/trace.cfg`
source $(realpath $(dirname "${BASH_SOURCE[0]}")/../etc/start.cfg)
tracetargets=$(cat $root/etc/trace.cfg)
if [ ! -d $logpath/$date ]
......
#!/bin/bash
source $HOME/microdep/etc/start.cfg
tracetargets=`cat $HOME/microdep/etc/trace.cfg`
source $(realpath $(dirname "${BASH_SOURCE[0]}")/../etc/start.cfg)
tracetargets=$(cat $root/etc/trace.cfg)
if [ ! -d $logpath/$date ]
......
#!/bin/bash
source $HOME/microdep/etc/start.cfg
source $(realpath $(dirname "${BASH_SOURCE[0]}")/../etc/start.cfg)
if [ -e $logpath/pids ]
then
......@@ -31,4 +31,4 @@ $rude -s $rudecfg > /dev/null 2> /dev/null &
echo "$!" >> $logpath/pids
$HOME/microdep/bin/start-trace.sh
$root/bin/start-trace.sh
#!/bin/bash
source $HOME/microdep/etc/start.cfg
source $(realpath $(dirname "${BASH_SOURCE[0]}")/../etc/start.cfg)
if [ ! -e $logpath/pids ]
then
......@@ -10,6 +10,6 @@ fi
for i in $(cat $logpath/pids); do kill $i; done
#ok sudo $HOME/microdep/bin/killtcpdump.sh
#ok sudo $root/bin/killtcpdump.sh
rm $logpath/pids
#!/bin/bash -x
source $HOME/microdep/etc/start.cfg
source $(realpath $(dirname "${BASH_SOURCE[0]}")/../etc/start.cfg)
> $logpath/$date/tcptraceroute_$1.gz
......
#!/bin/bash
source $HOME/microdep/etc/start.cfg
source $(realpath $(dirname "${BASH_SOURCE[0]}")/../etc/start.cfg)
log=$logpath/$date/traceroute_$1
......
#!/bin/bash
source $HOME/microdep/etc/start.cfg
source $(realpath $(dirname "${BASH_SOURCE[0]}")/../etc/start.cfg)
> $logpath/$date/traceroute_$1.gz
......
......@@ -2,7 +2,7 @@
# pick up changed config either in /etc or on web address
. $HOME/microdep/etc/start.cfg
source $(realpath $(dirname "${BASH_SOURCE[0]}")/../etc/start.cfg)
if test -s /etc/mp-rude/rude-list.conf ; then # distributed by puppet
if test ! -s $root/etc/rude.conf -o /etc/mp-rude/rude-list.conf -nt $root/etc/rude.conf; then
......
#!/bin/bash
source $HOME/microdep/etc/start.cfg
source $(realpath $(dirname "${BASH_SOURCE[0]}")/../etc/start.cfg)
vmstat | perl -e 'while(<>) { $utc=`date -u +%s`; chop $utc; print "$utc $_"; }' | gzip -c > $logpath/$date/vmstat.gz
......
#/bin/bash
#!/bin/bash
crude_port=10001
index="uninett"
root="$HOME/microdep"
root=$(realpath $(dirname "${BASH_SOURCE[0]}")/..)
logpath="$root/data"
event_dir="/var/log/mp-rude"
rudecfg="$root/etc/rude.cfg"
......@@ -18,10 +19,10 @@ rude="$root/bin/rude"
date=`env TZ=Europe/Oslo date +%Y-%m-%d`
if test -f $root/etc/parms.cfg; then
. $root/etc/parms.cfg
source $root/etc/parms.cfg
fi
if test -f $root/etc/local.cfg; then
. $root/etc/local.cfg
source $root/etc/local.cfg
fi
if test ! -s "$node_name"; then
......
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