-
Notifications
You must be signed in to change notification settings - Fork 56
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
Beesd script is not accepting options with arguments #205
Comments
Use BTW: Options with arguments are supposed to be used with |
Sorry, I was not detailed enough. |
Added Running with the arguments The argument parser needs to be changed, I think, so it either accepts arguments to options, or checks if an option is supported by ignoring anything after an = sign. |
Yeah I think there's a bug, I just looked at my old configuration: I passed the options to bees via The script has multiple problems anyways, i.e. it expects The problem with the arguments is that it parses the output from That's problematic from two perspectives: |
I can rewrite the script to use getopt to grab options. Any issue with that approach? |
Personally, I'd prefer if bees itself would do some of the things right within the C++ code (creating and size adjustments of the hash file), and only mounting deferred to outside of the process. But I think @Zygo as a different idea of how to split that due to reducing dependencies, and that is valid. If you ask me, starting bees right within the correct directory, it should figure out automatically most things, then we could delegate mounting to the systemd process with maybe a small pre-exec script which adjusts the environment. The bash script should not bother with any bees arguments: If it sees a path or uuid, let it extract that, the rest should be passed as-is to bees. Ideally, it doesn't need any getopt at all. No fancy parsing of the Some ideas: Just go through the arguments and either put them in a pass list, or if it starts with I could imagine that For systemd mode, a What do you think? |
BTW: There was an attempt by me to add configuration file support into bees natively, but I lost track of that during some personal live changes. The idea has not died yet but the branch is very outdated and I'd need to recap what I did there. Maybe you can find it useful: https://github.com/kakra/bees/commits/feature/configuration-files |
Well. I just have a problem with CPU consumption ant trying to fix it, a shell script fix is fast and easy. I'm a pragmatic person an look for direct solutions to my problems. 😄 That said. I don't like too much the current bees aproach to configuration and systemd interaction. Having to type the UUID of the drive every time I want to start or stop bees, for example. I agree that adding using getopt is adding an additional dependency. But I don't know any distribution that does not packaged it by default 😉 There's also the option to forget about long arguments, limit it to short options an then use the bash built-in getopts to parse the option. This my approach at work when server writing scripts (among other things right now I work as a sysadmin). Having a configuration file per btrfs set I think is OK. I don't want to give the same treatment to each of my btrf sets. But I agree that it must be bees itself reading the configuration file. I fact, I will put all the options in the configuration file. Having to modify the systemd unit file look ugly for me. Still I consider that beesd is buggy right now and having a fast and working fix to it is a must. If not, the final users like me will end having search for their own solution. And this is bad. So I propose to fix beesd script to work as documented and later on look for improving it. Later on I can take a look at the bees code itself and have it looking for the configuration file and taking the configuration from there. I just need to find some time for that. Expect to have two PR's coming from me. One for the script fix, and later on one for bees to read the configuration from the config file. Can you buy this? 😉 |
I might have had ideas but they were a long time ago... I got tired of dealing with multiple incompatible implementations of libuuid so I ripped out the code in bees that handles uuids. I guess we only need the uuid-to-string function from that library, so we could just import it instead of trying to sync up with a lib that users have the other versions of. For configuration, we need a solution that scales up to a lot of options. I'm thinking of having a simple 'name = value' inheritable dictionary-based configuration format. The names might follow a vaguely hierarchical convention like
Order and precedence gets a little wonky because we have to physically process item 3 before item 5, but we want the stuff in item 5 to be overridden by item 3. Not hard to solve with a priority system. The stuff in the first 100 lines of So after we read all that, we have all the stuff in one place that is currently in three places:
With a parsed config we would have a specification for a hash table format. Then we look at the hash table that's on disk, and if it's different (or missing), we either abort with an error, or we convert the data from the format it's in to the format specified in the configuration. A config option tells us which of those to do. Anyway that's all future stuff. For now, hack and slash the shell script until it works, if not properly, then at least usably. |
I have been trying to use beesd with the parameter --thread-count 2 to limit the CPU but fails. After some testing I found that it's taking the 2 as a parameter. Then it consider that is an unsupported parameter and bailing out to show the help message and stop.
I wonder if I'm missing something on how the parameters must be given to beesd.
If not I can voluteer to prepare a PR wit an improved script.
The text was updated successfully, but these errors were encountered: