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 78
current_counter="00$current_counter"
echo $current_counter > /tmp/counter
else
if [ $current_counter -lt 100 ]; then
current_counter="0$current_counter"
echo $current_counter > /tmp/counter
fi
fi
fi
# If the uploaded file must be sequenced for an index
# limited by the value of the variable $counter_max
if [ $suffix = sequenced ]; then
# If the limit is reached restart current counter at 1
if [ $current_counter -gt $counter_max ]; then
current_counter=001
fi
# Modify the path of the new file
source_file="/tmp/$2"/"snapshot_$current_counter".jpg
# Rename the file
cp $tmp $source_file; rm $tmp
# Increment the current counter
expr $current_counter+1>/tmp/counter
current_counter=`cat /tmp/counter`
# Change this current counter on a 3 digit if
# necessary
if [ $current_counter -lt 10 ]; then
current_counter="00$current_counter"
echo $current_counter > /tmp/counter
else
if [ $current_counter -lt 100 ]; then
current_counter="0$current_counter"
echo $current_counter > /tmp/counter
fi
fi
fi
# FTP connection
if [ x$passive_mode = xyes ]; then # Passive mode
sftpclient -L -s -m $ftp_server -n $port -c
$destination -k /tmp/$2 -u $user -w $pass
else # Non passive mode
sftpclient -L -m $ftp_server -n $port -c $destination
-k /tmp/$2 -u $user -w $pass
fi
if [ $? -eq 1 ]; then # If an error appeared
logger -t $0[$$] FTP failed! # Log this error
exit=1 # Exit the script
else
rm $source_file # Delete the files which has been uploaded
fi
fi
done
# Reset buffers
bufferd -reset -buffername $2