# Core dump when running script to get a file

**URL:** <https://forum.legato.io/t/core-dump-when-running-script-to-get-a-file/3158>\
**Category:** Legato Application Framework\
**Created:** [March 13, 2018, 6:21pm UTC](https://forum.legato.io/t/core-dump-when-running-script-to-get-a-file/3158 "2018-03-13T18:21:20Z")\
**Posts on this page:** 1\
**Showing post:** 16

<div class="post-metadata">

**Author:** ![EvetsMostel](https://avatars.discourse-cdn.com/v4/letter/e/3ab097/32.png) [@EvetsMostel](https://forum.legato.io/u/EvetsMostel)\
**Post date:** [March 16, 2018, 2:11pm UTC](https://forum.legato.io/t/core-dump-when-running-script-to-get-a-file/3158/16 "2018-03-16T14:11:22Z")

</div>

No, because this is a public forum and for security measures it has keys in the script. But you can do it by creating an AWS S3 resource and putting a 6 Meg file there.

Here is the template script:  
#!/bin/sh  
outputFile=“Your\_PATH”  
amzFile=“AMAZON\_FILE\_PATH”  
bucket=“YOUR\_BUCKET”  
resource=“/${bucket}/${amzFile}”  
contentType=“application/x-compressed-tar”  
dateValue=`date -R`  
stringToSign=“GET\n\n${contentType}\n${dateValue}\n${resource}”  
s3Key=“YOUR\_S3\_KEY”  
s3Secret=“YOUR\_S3SECRET”  
signature=`echo -en ${stringToSign} | openssl sha1 -hmac ${s3Secret} -binary | base64`

curl -H “Host: ${bucket}.s3.amazonaws.com”   
-H “Date: ${dateValue}”   
-H “Content-Type: ${contentType}”   
-H “Authorization: AWS ${s3Key}:${signature}”   
https://${bucket}.s3.amazonaws.com/${amzFile} -o $outputFile

You will need to compile base64 from the gnu coreutils as that isn’t included in the image. I used v8.25 since that matches the other things that are on Yocto.

I even went so far as to create a service which would start the binary created in the last exercise at boot (after everything), wait for an internet connection, then go get the file. However, I can’t seem to get it to automatically start for some reason. I can run it from the command line with /etc/init.d/scriptname.sh start, and that works. So I thought that I could run it from the Legato app that way, since I’m not actually starting it. However, I get the same issue, although the cutoff point seems to be slightly higher, but not much.

---

_[View the full topic](https://forum.legato.io/t/core-dump-when-running-script-to-get-a-file/3158)._
