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 75
#!/bin/mish
PATH=/bin:/sbin:/usr/bin:/usr/sbin
# Read the config file
. /etc/applications/config_$1
# Read the optional config file
if [ -e /etc/applications/pre_config_$1 ]; then
. /etc/applications/pre_config_$1
fi
# Stop the, by utask, started buffers
bufferd -stop -buffername $2
# Test if cc is present, if yes add -c $cc to the command, otherwise
# leave blank
if [ x$cc != "x" ]; then
copy="-c $cc"
fi
# Send the mail
smtpclient -s $subject -S $smtp_server -f $from -r $reply $copy -b $body $to
if [ $? -eq 1 ]; then
logger -t $0[$$] SMTP failed!
fi
# Path of the status file
status_file="/tmp/$2/status"
# Wait until bufferd is ready with the images, i.e. the status file is
# present and delete it after
expr $predelay + $postdelay > /tmp/B
tmp=`cat /tmp/B`; expr $tmp / 1000 > /tmp/B
tmp=`cat /tmp/B`; rm /tmp/B
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
# Reset and restart buffers
bufferd -reset -buffername $2
bufferd -start -buffername $2 -pre "$pre" -post "$post" -predelay
"$predelay" -postdelay "$postdelay" -uri
ftp://jpg/$sources/$image_format".jpg"