forked from alhazred/solaris-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ftp_fstat.sh
74 lines (66 loc) · 1.59 KB
/
ftp_fstat.sh
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
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/bin/sh
### fstat
###
### Script to check whether a FTP download
### session is in progress for a file
###
### Send all comments to: [email protected]
###
if [ $# -lt 1 ]
then
echo "usage: ./fstat <filename> or * for all files in directory"
exit
fi
cnt=$#
count=0
while [ $count -lt $cnt ]
do
if [ -d $1 ]
then
tput smso
echo "Skipping Directory entry $1...."
tput rmso
shift
count=`expr $count + 1`
continue
fi
if [ -f $1 ]
then
fuser $1 > /tmp/a 2>/tmp/c
if [ -s /tmp/a ]
then
b=`awk ' { print $1}' /tmp/a`
ps -ef | grep $b | grep ftp | grep -v "grep" > /tmp/b
if [ $? = 0 ]
then
tput smso
echo "Still Downloading $1 ......"
tput rmso
else
echo "Downloading Completed or a ftp session is not "
echo "currently in progress for the file $1"
fi
else
echo "Downloading Completed or a ftp session is not "
echo "currently in progress for the file $1"
fi
else
echo "File $1 Does Not Exist. Please specify a valid file."
count=`expr $count + 1`
shift
continue
fi
count=`expr $count + 1`
shift
done
##############################################################################
### This script is submitted to BigAdmin by a user of the BigAdmin community.
### Sun Microsystems, Inc. is not responsible for the
### contents or the code enclosed.
###
###
### Copyright 2006 Sun Microsystems, Inc. ALL RIGHTS RESERVED
### Use of this software is authorized pursuant to the
### terms of the license found at
### http://www.sun.com/bigadmin/common/berkeley_license.html
##############################################################################