-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprg_run_check.sh
More file actions
executable file
·35 lines (29 loc) · 1014 Bytes
/
prg_run_check.sh
File metadata and controls
executable file
·35 lines (29 loc) · 1014 Bytes
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
#!/bin/bash
##########################################################################################
# B7 check running script
# Autor : Radek Nakoukal
# 18.6.2015
#
# This UNIX shell script FTPs all the files in the input directory to a remote directory
###########################################################################################
###########################################################################################
# script with parameters
# 1 - script name
###########################################################################################
SRCDIR=$(/home/pi/b7/get_setting.sh file)
LOGDIR="$SRCDIR/program_log"
if [ "$#" -ne 1 ]; then
echo "Illegal number of parameters"
exit;
fi
while :
do
DATUM=$(date +%y%m%d-%H%M%S)
ps_out=`ps -ef | grep $1 | grep -v 'grep' | grep -v $0`
result=$(echo $ps_out | grep "$1")
if [[ "$result" == "" ]];then
echo "$DATUM $1 Not Running starting..." >> $LOGDIR/running.log
sh ./$1 > /dev/null 2>&1
fi
sleep 5
done