Upgrade, Backup and Restore script from Docs-page not working?

Hi,
I’m trying to use the Upgrade, Backup and Restore script from Docs-page, but I’m several of errors??

I’m starting as user pi, the script belongs to pi and is executable. I can start the script with or without “sudo”, no change.

Error

Failed to stop openhab2.service\x0d.service: Unit openhab2.service\x0d.service not loaded.

coming from the line:

sudo systemctl stop openhab2.service
when using that line directly, it is working as expected?
I guess the following errors are caused by the same mistake.

I must be doing something terribly stupid, but what?

When doing the update manuallly, using all the lines from the script it is working.

I guess you cut&paste the script from the website into a file.
And probably you did that on a windos box, then copied the script to your PI?
"\x0d" is a carriage return. So i think you have a format problem.
Check if it’s UTF-8 or ASCII.

Yes the charset was “us-ascii” , have to look how to change that.

Thanks

Hello Jürgen / @opus,

these lines were never intended to be executed as a shell script - meaning fully automatic, with error handling and such. They are just a collection of commands which I would advice to execute step by step. Continue with the next line only if the result of the one before was successful or the given error message makes sense in your situation (like deleting something that’s not on your system in the first place). Be careful executing commands whose purpose you do not know.

Regarding your error, @Oli gave excellent advice. Please execute the command on its own and it should work. Good luck!

OK.
I used a similar script before to do that ( the major difference would be it didn’t start/stop the service), which made me believe that those lines were intended to be script.

No problem at all.
Thanks
Closing!