Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bash-related fixes. #4

Merged
merged 1 commit into from
Jan 22, 2016
Merged

Bash-related fixes. #4

merged 1 commit into from
Jan 22, 2016

Conversation

dumol
Copy link

@dumol dumol commented Apr 7, 2015

Problem

When run directly, the Zabbix backup script works as expected and only the relevant DBs are backed-up. But when run through backupninja, it backups up the entire Zabbix DB.

Solution

Use $BASH_SOURCE instead of $0 to account for instances when the script is invoked by another script, as is the case with backupninja scripts. Otherwise this happens when populating DATA_TABLES from the end section of the script:

+++ DATA_TABLES=()
+++ read line
++++ sed '0,/^__DATA__$/d' /usr/sbin/backupninja
++++ tr -s ' '

Drive-by fix:

  • changed the shebang to one that doesn't assume the bash binary to be available in /bin, which is not the case for the BSDs and some other Unixes.

@@ -49,7 +54,7 @@
# DEFAULT VALUES
#
# following will store the backup in a subdirectory of the current directory
DUMPDIR="$(dirname "$(realpath -s "$0")")"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The realpath programa is not installed by default in Ubuntu 12.04 nor 14.04.

I think a mention to this requirement is made necessary, or maybe another solution.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems you are right. Perhaps DUMPDIR should be initiated with .? Can't see any reason for the current, seemingly over-engineered, situation.

I suggest you try your hand at a pull request for this problem. Hope your PR will be luckier than this one… ;-]

@jva5007
Copy link

jva5007 commented Dec 21, 2015

Hi,

I got the following error while running the backup script.

"ERROR: The number of large data tables configured in this script is less than 5."

Zabbix server version is 2.2.8.

Please let me know how can I fix this error.

Thank You.

@maxhq maxhq merged commit e86f0d3 into maxhq:master Jan 22, 2016
maxhq pushed a commit that referenced this pull request Jan 22, 2016
@maxhq
Copy link
Owner

maxhq commented Jan 22, 2016

@dumol I am very sorry for the (almost) 1st anniversary of your pull request. I haven't been working with Zabbix for a long time. Thank you very much for your changes though!

@dumol
Copy link
Author

dumol commented Jan 22, 2016

Thanks anyway! Perhaps next time I'll have changes to your script I'll fork it and continue to maintain it… ;-]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants