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

Add systemd service to Debian package #77

Open
MichaIng opened this issue Mar 3, 2020 · 2 comments
Open

Add systemd service to Debian package #77

MichaIng opened this issue Mar 3, 2020 · 2 comments

Comments

@MichaIng
Copy link
Contributor

MichaIng commented Mar 3, 2020

Did you thing about a systemd service? Something like:

[Unit]
Description=vmtouch
Documentation=https://github.com/hoytech/vmtouch/blob/master/vmtouch.pod
DefaultDependencies=no
After=local-fs.target
Conflicts=shutdown.target
Before=shutdown.target

[Service]
EnvironmentFile=/etc/default/vmtouch
ExecStart=/usr/bin/vmtouch $VMTOUCH_OPTIONS $VMTOUCH_FILES

[Install]
WantedBy=local-fs.target

A problem is that it does not work with the same options as the sysvinit service does (default environment file):

  • -d would require Type=forking and at best a PID file then as well. But for systemd it is not required and IMO preferable to get binary output as well, to run it with default Type=simple and no daemon mode.
  • User/Group cannot be applied with VMTOUCH_USER_GROUP variable (?), or it would require to separate it in an ugly ExecStartPre step or something.
  • ENABLE_VMTOUCH IMO does not make any sense at all. Instead of changing this variable, one should simply disable the service.
@hoytech
Copy link
Owner

hoytech commented Mar 24, 2020

Hey, actually I'm more inclined to remove the service/daemon stuff from the debian package. Running it as a daemon is actually a fairly uncommon use-case. Usually people use vmtouch as an interactive tool, or in a cron job. The daemon only makes sense when you're doing memory locking, and there are a lot of different ways you might want to do this, it's hard to make a fully generic service definition, I think.

@MichaIng
Copy link
Contributor Author

@hoytech
Basically, if the service implementation allows to freely adjust the command arguments, it can be reasonable in all cases, e.g. lifting certain files into cache once at boot only, or obtaining current fs cache situation and store or print it somewhere etc. But yeah in many cases that would need a service adjustment as well, e.g. change Before=/After=, default output or a timer and such. At least the service allows to run it with a fixed user and environment repeatedly.

Our little distro/overlay uses now vmtouch as a replacement for a tmpfs to store scripts and settings files for fast execution/reading. The tmpfs has the large disadvantage that files need to be copied there on boot and stored back to disk on shutdown. Editing them on disk is overwritten and a system crash causes changes to be lost. So using the native fs cache is much better, as long as one does not care about fs writes, e.g. when worrying about SDcard wear, in case of plain text config files not an issue... Generally I think that it could be omitted completely, since native fs cache is already done nicely on regularly read files, but I didn't want to loose the performance boost completely for now. But indeed we use an own compiled deb package with an own service file and default config, hence having this in upstream is not necessarily required.

Repository owner deleted a comment from Rajib734 Jun 7, 2020
Repository owner deleted a comment from Rajib734 Jun 7, 2020
Repository owner deleted a comment from Rajib734 Jun 7, 2020
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

No branches or pull requests

2 participants