View previous topic :: View next topic |
Author |
Message |
josedb Apprentice
Joined: 03 Nov 2006 Posts: 222
|
Posted: Thu Jan 09, 2014 4:16 pm Post subject: Webmin and systemd |
|
|
Hello everyone, i have replaced openRC with systemd , and when i install webmin it wont list the asociated service, so i cannot start it. i ve already searched over google, and only found this problem mentione in arch forums, service is called webmin.service.
any suggest? thanks |
|
Back to top |
|
|
Marlo Veteran
Joined: 26 Jul 2003 Posts: 1591
|
Posted: Thu Jan 09, 2014 8:02 pm Post subject: |
|
|
Try this:
/etc/systemd/system/webmin.service wrote: |
[Unit]
Description=Webmin Admin Tool
Requires=local-fs.target
After=basic.target
Before=smartd.service
DefaultDependencies=no
Conflicts=shutdown.target
[Service]
Type=oneshot
ExecStart=/usr/libexec/webmin/miniserv.pl /etc/webmin/miniserv.conf
RemainAfterExit=yes
PrivateTmp=true
[Install]
WantedBy=multi-user.target |
And start it with 'systemctl start webmin.service' _________________ ------------------------------------------------------------------
http://radio.garden/ |
|
Back to top |
|
|
josedb Apprentice
Joined: 03 Nov 2006 Posts: 222
|
Posted: Thu Jan 09, 2014 9:04 pm Post subject: |
|
|
and it works, thank you very much for this |
|
Back to top |
|
|
666threesixes666 Veteran
Joined: 31 May 2011 Posts: 1248 Location: 42.68n 85.41w
|
Posted: Fri Jan 10, 2014 3:10 am Post subject: |
|
|
file a bug and include the service state that the service does not ship with the ebuild. last i checked systemd and openrc are officially supported init systems. |
|
Back to top |
|
|
josedb Apprentice
Joined: 03 Nov 2006 Posts: 222
|
Posted: Fri Jan 10, 2014 4:47 pm Post subject: |
|
|
i'd like to colaborate with this, but i dont know where and how. |
|
Back to top |
|
|
666threesixes666 Veteran
Joined: 31 May 2011 Posts: 1248 Location: 42.68n 85.41w
|
Posted: Fri Jan 10, 2014 11:24 pm Post subject: |
|
|
you're almost there.... bugs.gentoo.org instead of forums.gentoo.org you might want to look in the settings to enable email so you get notifications when people post responses. |
|
Back to top |
|
|
PhobosK n00b
Joined: 07 Apr 2007 Posts: 14
|
Posted: Sun Jun 01, 2014 9:43 am Post subject: |
|
|
I have taken care of fixing and reporting the systemd integration - The bug report containing an ebuild with systemd support
The new ebuild and changes are under review to be commited to the portage tree.
Meanwhile if you want a quick resolution, you may put the new ebuild and the supporting files in files/ folder in your local overlay and emerge.
A very quick resolution is to use this service file (/etc/systemd/system/webmin.service):
Code: |
[Unit]
Description=Webmin Administration Tool
After=network.target remote-fs.target nss-lookup.target
ConditionFileNotEmpty=/etc/webmin/config
ConditionFileNotEmpty=/etc/webmin/miniserv.conf
[Service]
RemainAfterExit=yes
KillMode=mixed
# Webmin is exiting with 1 on SIGTERM
SuccessExitStatus=1
ExecStart=/usr/libexec/webmin/miniserv.pl /etc/webmin/miniserv.conf
PIDFile=/var/run/webmin.pid
Environment="PERLLIB=/usr/libexec/webmin" LANG=
ExecReload=/bin/kill -USR1 $MAINPID
[Install]
WantedBy=multi-user.target
|
But have in mind that using only this file without the changes in the Webmin's own start/stop/reload/restart scripts in /etc/webmin will result in that the stop/restart command button in the WebGUI of Webmin not work.
As a side note: the given in the above post (by Marlo) service file works but is not the correct way to add webmin as systemd service, since Webmin is a forking service that on SIGTERM exits with 1.
EDIT: Service type changed to simple, because in the rare cases when Webmin's option nofork is enabled, the service type forking will block untill timeout.... |
|
Back to top |
|
|
PhobosK n00b
Joined: 07 Apr 2007 Posts: 14
|
Posted: Sat Jun 07, 2014 11:51 am Post subject: |
|
|
The fix is now committed to portage, so just update portage and emerge webmin |
|
Back to top |
|
|
steveL Watchman
Joined: 13 Sep 2006 Posts: 5153 Location: The Peanut Gallery
|
Posted: Sat Jun 07, 2014 10:26 pm Post subject: |
|
|
Nice work, PhobosK.
One minor flaw I noticed in the initscript change; and not sure if it made it to final, but should be fixed on next bump, for robustness is:
Code: | if [ ! -f ${WEBMIN_CONFIG} ]; then |
This should be:
Code: | if ! [ -f "$WEBMIN_CONFIG" ]; then |
You can add redundant braces if you want, but they don't stop you needing quoting. There's a note in the POSIX sh docs somewhere that ! [ test ] is preferred. Not quoting is a no-no.
If you write robustly, you never have to worry about constraints like "we know it's always a particular type of dirname" which might break under prefix, or if the user is trying out something, which makes the script and the project using it more flexible, as well as giving reliability. |
|
Back to top |
|
|
PhobosK n00b
Joined: 07 Apr 2007 Posts: 14
|
Posted: Sun Jun 08, 2014 3:55 am Post subject: |
|
|
Thanks for the suggestions @steveL,
you are right that quoting is better and generally I'm using it but this time I did the replacement a bit lazier
I'll fix that next time.
As for the negation of a test command in an if statement... I dunno... It shouldn't matter, especially when the test expression is a two arguments one..... Generally in the docs it's said that negating is done as
I checked the posix compliance and it is ok that way... didn't find that ! [ test ] is preferred... Even if you check the scripts in the portage tree only a couple of them use it as ! [ test ] , everything else is in the form docs state it...
Anyway I guess it is more like a coding habit....
Thanks again for the review |
|
Back to top |
|
|
steveL Watchman
Joined: 13 Sep 2006 Posts: 5153 Location: The Peanut Gallery
|
Posted: Sun Jun 08, 2014 4:26 am Post subject: |
|
|
PhobosK wrote: | As for the negation of a test command in an if statement... I dunno... It shouldn't matter, especially when the test expression is a two arguments one..... Generally in the docs it's said that negating is done as
I checked the posix compliance and it is ok that way... didn't find that ! [ test ] is preferred |
I confused POSIX with autotools portability on this point, so yeah, it's more about portability to all sh, which isn't so relevant. For instance I rely on expansion of "$@" working correctly (ie: evaluating to nothing when there are no args to the function).
The point being: ! cmd has to be supported for any command (or pipeline); consider:
Code: | if ! grep -qF 'foobar' "$file"; then |
..but, yes, test supports ! per POSIX. We still don't rely on it in configure space, but I have no axe to grind about it. My main concern was the quoting, which is essential. |
|
Back to top |
|
|
|