Problem copying files to S3 bucket

Azhar Ali

Member
Hi,

I am trying to copy the recorded files to an S3 bucket and its not working and I have not been able to figure out whats wrong with it. So far I have tried following:
1) I know my hook is getting called because I have a test script in it which copies the file in records folder with a new name. Thats working.
2) If I manually call ./S3-AWS4-Upload.sh $2 that copies the file to s3 correctly.

Below is the code of my hook.
Code:
# This script copies a recorded stream to client/records
STREAM_NAME=$1
SRC_FILE=$2
SRC_DIR="/usr/local/FlashphonerWebCallServer/records/"
REPLACE_STR="/usr/local/FlashphonerWebCallServer/records/NewName-$STREAM_NAME-"
DST_FILE="${SRC_FILE/$SRC_DIR/$REPLACE_STR}"
cp $SRC_FILE $DST_FILE

FILE_PATH=$2
sudo ./S3-AWS4-Upload.sh $FILE_PATH
echo "Record complete. Sent to S3. $FILE_PATH" >>/usr/local/FlashphonerWebCallS$
I have also tried few variations of the
1) sudo ./S3-AWS4-Upload.sh $FILE_PATH
2) ./S3-AWS4-Upload.sh $FILE_PATH
3) chmod +x S3-AWS4-Upload.sh
./S3-AWS4-Upload.sh $FILE_PATH

Manually calling ./S3-AWS4-Upload.sh /usr/local/FlashphonerWebCallServer/records/MdoQ22zaTFDu1551796198938-315859e0-3f53-11e9-a002-15436f32bb6b.mp4 uploads the file on s3

Log file which gets created have the following text in it
Sent to S3. /usr/local/FlashphonerWebCallServer/records/MdoQ22zaTFDu1551796198938-315859e0-3f53-11e9-a002-15436f32bb6b.mp4


Any ideas?
 
Last edited:

Azhar Ali

Member
I would have thought that line is there if the file was located in the tmp/11 directory. I have moved the file into the bin to avoid any path issues and keys are also hard coded in the S3-AWS4-Upload.sh file. Please see capture1.png

Also if I run the script manually in putty, file is copied over to S3. Please see capture2.png
I know it must be something I am not doing right but due to limited knowledge if you can help that would be great.
 

Attachments

Top