-
Notifications
You must be signed in to change notification settings - Fork 0
/
RCP
executable file
·59 lines (46 loc) · 799 Bytes
/
RCP
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/bin/ksh
function DebugMessage
{
if [[ -f ${DEBUG} ]]
then
print $@ >>${RCPOUT}
fi
}
function WriteStat
{
DebugMessage "${1} has been changed in ${2}"
if [[ -z ${3} ]]
then
print ${2} > ${1}
else
print "${2};${3}" > ${1}
fi
}
FILENAME=${1##*/}
RCPOUT=${TEMPRCPDEBUG}/${FILENAME}.log
if [[ -f ${DEBUG} ]]
then
>${RCPOUT}
fi
STAT=${TEMPRCP}/${FILENAME}
if [[ ! -f ${STAT} ]]
then
DebugMessage "Warning:${STAT} was not found!"
return 1
fi
trap "print FAIL > ${STAT};kill 0;exit 1" 1 2 3 15
WriteStat ${STAT} "IP" "$$"
DebugMessage "Running rcp ${@:-}"
if [[ -z ${RCP_CMD} ]]
then
RCP_CMD=rcp
fi
${RCP_CMD} "${@:-}"
RET=$?
DebugMessage "Return value is $RET"
if [[ $RET == 0 ]]
then
WriteStat ${STAT} "CO"
else
WriteStat ${STAT} "FAIL"
fi