summaryrefslogtreecommitdiff
path: root/test/pers_pfs_test_starter.sh
blob: 418e2fe6dbf4b2261de567370bfd70240e4bee55 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/bash

# Use this script to start the persistence power fail save test after system restart

# HOW TO USE
# to start this script on startup, copy the systemd service file persistence-pfs-test-start.service to /lib/systemd/system/
# Create also a link from /lib/systemd/system/multi-user.target.wants 
# to the persistence-pfs-test-start.service in /lib/systemd/system/

echo "Starting persistence power fail save test"

check_process() {
  echo "$ts: checking $1"
  [ "$1" = "" ]  && return 0
  [ `pgrep -n $1` ] && return 1 || return 0
}

#!!!!!!!!!!!!dlt daemon has to run before starting test
# check if already running, otherwise error
# timestamp
ts=`date +%T`

echo "$ts: begin checking apps needed..."
check_process "dlt-daemon"
if [ $? == 0 ]
then
   echo "$ts: not running, starting ..."
   dlt-daemon &
else
   echo "$ts: already running..."
fi

export LD_LIBRARY_PATH='/usr/lib/'

if [ $# != 0 ]
then
   numLoops=$1
else
  numLoops=10000000
fi
  
/usr/bin/persistence_pfs_test "-l $numLoops" "-s/dev/ttyUSB0"
 

echo "End of persistence power fail save test"