Dreaded "Didn't back up" mistake

First : Very important lesson learned about backing up my files.
Thankfully, the only file impacted is my script.yaml file in /config/packages folder. Somehow I saved the document as blank and now it has nothing in it. I haven’t restarted HA yet and I can still see the scripts on the front end.

I have HA running on HASSIO through Docker on Synology. After reading This Link I was able to SSH into my synology and can see the contents of the configuration.yaml file which if that were the file I was missing, I could easily copy and paste the information. However, I am trying to get to the scripts.yaml file which is located in /packages. After doing step 5 of the support thread, I am able to see the packages directory, but i am unable to open the script.yaml file the same way I did with the configuration file. I tried modifying step 6 by doing vi /packages/script.yaml but it returns nothing. Is there ANYWAY to recover the script.yaml content from HA before I restart it and it looses all the scripts?

Not if you wrote a blank file to it AFAIK.

Don’t know if it will help you but there are file recovery software you can use.

I used it on our camera SD card when it got corrupt.
Not only could I recover the files that should be there but also files that was several months old and should have been overwritten.
Don’t ask me how it works, but it costed about $100 for one month if I recall correctly.
Worth it for me and my case but not sure about one yaml file.
Maybe you can try a free/trail version and see if it works for you.

What is the software?

Also the more you use the card now, the less likely to be able to recover a file. Mount it read only until you fix it (or give up)

I have no clue.
It was one of the top results when you Google it.
Maybe it’s still installed on the laptop, but my daughter was kind enough to place a toy on the keyboard and closing the lid… Hard…
A replacement screen is on its way here. Hopefully today.

I’ve had success with Recuva (free). Only on windows formatted drives though. Not sure if it does linux.

That is valid point.
That SD card was windows formatted.
Not sure if there even exist a software for Linux formatted cards.

I have recovered data from ext2/ext3 disks, but it was years ago! Cannot remember how but is is, of course, possible.

I guess you could try modifying one of your scripts from the frontend and savig it. HA will then write back the changes to your scripts.yaml. I am not sure how it is when the scripts are in package folders. But I guess it is something you can try out quickly.