Cron + borgmatic + "set -e" = unknown error #131

Closed
opened 2019-01-02 16:22:17 +00:00 by patricko · 4 comments

I made a small wrapper around borgmatic and it runs completely fine manually.

But when I run it with crontab, it doesn't work.

The issue comes from this line: set -e which exits on any error.

So when ran manually as root it works, but when ran with cron as root, it doesn't work.

I google a bit and found this: https://stackoverflow.com/questions/2870130/why-does-using-set-e-cause-my-script-to-fail-when-called-in-crontab

They say it might be an environment variable issue. But I don't use any, it's only hardcoded values in my script. So I looked at the borgmatic conf and only found the {hostname} thing, but I don't know if it's related.

Do you have an idea what may be failing in that case?? it's making me stuck for few days already :'(

I made a small wrapper around borgmatic and it runs completely fine manually. But when I run it with crontab, it doesn't work. The issue comes from this line: `set -e` which exits on any error. So when ran manually as root it works, but when ran with cron as root, it doesn't work. I google a bit and found this: https://stackoverflow.com/questions/2870130/why-does-using-set-e-cause-my-script-to-fail-when-called-in-crontab They say it might be an environment variable issue. But I don't use any, it's only hardcoded values in my script. So I looked at the borgmatic conf and only found the {hostname} thing, but I don't know if it's related. Do you have an idea what may be failing in that case?? it's making me stuck for few days already :'(
Author

Not related to borgmatic haha

Not related to borgmatic haha
Owner

I'm curious.. What was it?

I'm curious.. What was it?
Author

I called a python script with the pre-hook in borgmatic, and that required me to set a specific locale for it to work (dunno if it's a bug from the script or from my installation) and it didn't work in cron because cron has default locale I guess

So I'm gonna try to change the default locale so I avoid this kind of bug in the future, let's pray :p

I called a python script with the pre-hook in borgmatic, and that required me to set a specific locale for it to work (dunno if it's a bug from the script or from my installation) and it didn't work in cron because cron has default locale I guess So I'm gonna try to change the default locale so I avoid this kind of bug in the future, let's pray :p
Owner

Got it. Hope that works!

Got it. Hope that works!
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: borgmatic-collective/borgmatic#131
No description provided.