[opensuse-packaging] systemd service file question
I'm testing (using) autossh. It has a service file that is designed to be installed immediately via zypper and then manually edited. That works until you re-install the package, at which point it replaces my edits with the virgin service file. What's the right way to fix this. FYI, this is the current service file in the RPM ===========[Unit] Description=AutoSSH service for port 2222 After=network.target [Service] Environment="AUTOSSH_GATETIME=0" ExecStart=/usr/bin/autossh -M 0 -NL 2222:localhost:2222 -o TCPKeepAlive=yes foo@bar.com [Install] WantedBy=multi-user.target =========== As you can see there are several things on the ExecStart line that need to be edited for this to work. fyi2: In the sysvinit days there was a separate config file, but whoever converted it to a systemd service file dropped that functionality. Thanks Greg -- Greg Freemyer -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-packaging+owner@opensuse.org
On Friday 2015-05-01 19:42, Greg Freemyer wrote:
It has a service file that is designed to be installed immediately via zypper and then manually edited. That works until you re-install the package, at which point it replaces my edits with the virgin service file.
Your edits belong into /etc/systemd/system/autossh.service.d/my.conf [Service] ExecStart=newcommandline …do _not_ edit /usr/lib/systemd/ manually ;-) -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-packaging+owner@opensuse.org
В Fri, 1 May 2015 19:57:52 +0200 (CEST) Jan Engelhardt <jengelh@inai.de> пишет:
On Friday 2015-05-01 19:42, Greg Freemyer wrote:
It has a service file that is designed to be installed immediately via zypper and then manually edited. That works until you re-install the package, at which point it replaces my edits with the virgin service file.
Your edits belong into /etc/systemd/system/autossh.service.d/my.conf
[Service] ExecStart=newcommandline
It probably should be ExecStart= ExecStart=new command line otherwise it will be added in addition to existing command line.
…do _not_ edit /usr/lib/systemd/ manually ;-)
-- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-packaging+owner@opensuse.org
On Fri, 1 May 2015 21:49, Andrei Borzenkov wrote:
On Fri, 1 May 2015 19:57:52 +0200 Jan Engelhardt wrote:
On Friday 2015-05-01 19:42, Greg Freemyer wrote:
It has a service file that is designed to be installed immediately via zypper and then manually edited. That works until you re-install the package, at which point it replaces my edits with the virgin service file.
Your edits belong into /etc/systemd/system/autossh.service.d/my.conf
[Service] ExecStart=newcommandline
It probably should be
ExecStart= ExecStart=new command line
otherwise it will be added in addition to existing command line.
…do _not_ edit /usr/lib/systemd/ manually ;-)
Question: Could the autossh package contain this file: "/etc/systemd/system/autossh.service.d/my.conf" with the content: [code] [Service] ExecStart= ExecStart=new valid autossh command line here [/code] and have the relevant notice made in the man-page? That way the idea to edit the main service file would be much better supressed than otherwise. Thanks for the consideration. - Yamaban.
On Fri, May 1, 2015 at 3:56 PM, Yamaban <foerster@lisas.de> wrote:
On Fri, 1 May 2015 21:49, Andrei Borzenkov wrote:
On Fri, 1 May 2015 19:57:52 +0200 Jan Engelhardt wrote:
On Friday 2015-05-01 19:42, Greg Freemyer wrote:
It has a service file that is designed to be installed immediately via zypper and then manually edited. That works until you re-install the package, at which point it replaces my edits with the virgin service file.
Your edits belong into /etc/systemd/system/autossh.service.d/my.conf
[Service] ExecStart=newcommandline
It probably should be
ExecStart= ExecStart=new command line
otherwise it will be added in addition to existing command line.
…do _not_ edit /usr/lib/systemd/ manually ;-)
Question: Could the autossh package contain this file: "/etc/systemd/system/autossh.service.d/my.conf" with the content: [code]
[Service] ExecStart= ExecStart=new valid autossh command line here
[/code]
and have the relevant notice made in the man-page?
That way the idea to edit the main service file would be much better supressed than otherwise.
Thanks for the consideration. - Yamaban.
I don't maintain autossh, but I will create a SR to clean this up if you guys can guide me to the best approach. On my own I would edit the /usr/lib/systemd service file to have: ========== # DO NOT EDIT THIS FILE, # use /etc/systemd/system/autossh.service.d/my.conf to override this file instead [Unit] Description=AutoSSH service for port 2222 After=network.target [Service] Environment="AUTOSSH_GATETIME=0" ExecStart=echo "The file /etc/systemd/system/autossh.service.d/my.conf MUST be edited to override this assignment.". [Install] WantedBy=multi-user.target # DO NOT EDIT THIS FILE =========== Then I would add a sample/template file to /etc/systemd/system/autossh.service.d/my.conf It would have content: ======================= # Override and reset the Description to blank Description= # Then append my local description to the blank Description Description=AutoSSH service for ssh reverse tunnel # Override and reset ExecStart to blank ExecStart= # Append a legal command to create a normal encrypted tunnel # ExecStart=/usr/bin/autossh -M 0 -NL 2222:localhost:2222 -o TCPKeepAlive=yes foo@bar.com # OR # Append a legal command to create a reverse encrypted tunnel # ExecStart=/usr/bin/autossh -M 0 -NR 2222:localhost:2222 -o TCPKeepAlive=yes foo@bar.com ======================= Let me know if there is a preferred or "openSUSE" approach to do this. Thanks Greg -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-packaging+owner@opensuse.org
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 01.05.2015 Greg Freemyer wrote:
Let me know if there is a preferred or "openSUSE" approach to do this.
I do not know about about the openSUSE approach, just wanted to give you a big round of applause, as your changes seem pretty understandable to me as someone who does not know the package at all. But I would have known what to do and what not to do. Johannes -----BEGIN PGP SIGNATURE----- Comment: Using GnuPG with SeaMonkey - http://www.enigmail.net/ iEYEARECAAYFAlVJBXwACgkQzi3gQ/xETbKSAwCeNTrupWdXIUo0z8YUbxRHYrv8 U30AoI+jDoBP6bjBO1TRUN3tWvf9flso =7aLz -----END PGP SIGNATURE----- -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-packaging+owner@opensuse.org
On Tue, May 5, 2015 at 2:01 PM, Johannes Kastl <mail@ojkastl.de> wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On 01.05.2015 Greg Freemyer wrote:
Let me know if there is a preferred or "openSUSE" approach to do this.
I do not know about about the openSUSE approach, just wanted to give you a big round of applause, as your changes seem pretty understandable to me as someone who does not know the package at all. But I would have known what to do and what not to do.
Johannes
Thanks Johannes, Since no one has made suggestions as to how I handled the service file I've updated the wiki page to reflect the 444 change on the install: https://en.opensuse.org/openSUSE:Systemd_packaging_guidelines#Service_files and created this to document instantiated service files https://en.opensuse.org/openSUSE:Systemd_packaging_guidelines#Instantiated_S... Greg -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-packaging+owner@opensuse.org
On Fri, May 1, 2015 at 3:49 PM, Andrei Borzenkov <arvidjaar@gmail.com> wrote:
В Fri, 1 May 2015 19:57:52 +0200 (CEST) Jan Engelhardt <jengelh@inai.de> пишет:
On Friday 2015-05-01 19:42, Greg Freemyer wrote:
It has a service file that is designed to be installed immediately via zypper and then manually edited. That works until you re-install the package, at which point it replaces my edits with the virgin service file.
Your edits belong into /etc/systemd/system/autossh.service.d/my.conf
[Service] ExecStart=newcommandline
It probably should be
ExecStart= ExecStart=new command line
otherwise it will be added in addition to existing command line.
Thank you, I was getting syntax errors with the other way. Greg -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-packaging+owner@opensuse.org
В Fri, 1 May 2015 16:14:38 -0400 Greg Freemyer <greg.freemyer@gmail.com> пишет:
On Fri, May 1, 2015 at 3:49 PM, Andrei Borzenkov <arvidjaar@gmail.com> wrote:
В Fri, 1 May 2015 19:57:52 +0200 (CEST) Jan Engelhardt <jengelh@inai.de> пишет:
On Friday 2015-05-01 19:42, Greg Freemyer wrote:
It has a service file that is designed to be installed immediately via zypper and then manually edited. That works until you re-install the package, at which point it replaces my edits with the virgin service file.
Your edits belong into /etc/systemd/system/autossh.service.d/my.conf
[Service] ExecStart=newcommandline
It probably should be
ExecStart= ExecStart=new command line
otherwise it will be added in addition to existing command line.
Thank you, I was getting syntax errors with the other way.
Yes; only one ExecStart is allowed unless service is oneshot, but when parsing it systemd does not know yet what service type it has. -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-packaging+owner@opensuse.org
participants (5)
-
Andrei Borzenkov
-
Greg Freemyer
-
Jan Engelhardt
-
Johannes Kastl
-
Yamaban