System information
Shell Script Examples
Axis Communications AB provides NO support for application development of any kind. The information
here is provided "as is", and there is no guarantee that any of the examples shown will work in your
particular application.
Revision 1.02 October 2002 83
while[!-f$status_file ]; do
sleep $tmp
done
rm $status_file
# FTP connection
if [ x$passive_mode = xyes ]; then
sftpclient -L -s -m $ftp_server -n $port -c $destination -k
/tmp/$2 -u $user -w $pass
else
sftpclient -L -m $ftp_server -n $port -c $destination -k /tmp/$2 –
u $user -w $pass
fi
if [ $? -eq 1 ]; then
logger -t $0[$$] FTP failed!
fi
# Reset and restart buffer for alarm images
bufferd -reset -buffername $2
bufferd -start -buffername $2 -pre "$pre" -post "$post" -predelay
"$predelay" -postdelay "$postdelay" -uri
ftp://jpg/$sources/$image_format".jpg"
# Start buffer for sequential images
bufferd -start -buffername $3 -snapshot -pre 1 -predelay "$delay" -uri
ftp://jpg/"$seq_sources"/"$seq_image_format".jpg
session_time=0 # Time during this session
expr $time \* 1000 > /tmp/F
time=`cat /tmp/F`; rm /tmp/F # Convert the time in milliseconds
# Path of the directory of the sequential image
source_file="/tmp/$3"
while[!-d$source_file ]; do # Wait the creation of the directory
done
cd $source_file # Change to the directory specified above
exit=0
while [ $exit=0];do#While no errors appeared
# If the time to stay in the script has been reach
if [ $session_time -ge $time ]; then
if [ $time -ne -1000 ]; then # If not infinite
exit=1 # Exit the script
fi
# Calculate the session time
else
expr $session_time + $delay > /tmp/F
session_time=`cat /tmp/F`; rm /tmp/F
fi
if [ $exit -ne 1 ]; then
# Path of the directory of the image
source_file="/tmp/$3"
OK=0 # Image not found
# While the image has not been found
while [ $OK=0];do
tmp=`ls` # List the file on the directory
# If there is a file inside
if[!-z$tmp ]; then
# Do not take an incomplete image
if [ $tmp != tmpimage ]; then