Bug 789901 - Provide native systemd service
Provide native systemd service
Status: CLOSED RAWHIDE
Product: Fedora
Classification: Fedora
Component: monotone (Show other bugs)
rawhide
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Thomas Moschny
Fedora Extras Quality Assurance
: FutureFeature, Reopened
Depends On:
Blocks: SysVtoSystemd 751869
  Show dependency treegraph
 
Reported: 2012-02-13 03:44 EST by Jóhann B. Guðmundsson
Modified: 2016-02-15 16:21 EST (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-02-15 16:21:40 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Native systemd service file for monotone (438 bytes, text/plain)
2012-02-13 03:46 EST, Jóhann B. Guðmundsson
no flags Details

  None (edit)
Description Jóhann B. Guðmundsson 2012-02-13 03:44:02 EST
Description of problem:

Let's get the ball rolling on this one...

http://fedoraproject.org/wiki/Features/SysVtoSystemd
https://fedoraproject.org/wiki/Packaging:Guidelines:Systemd
https://fedoraproject.org/wiki/Packaging:ScriptletSnippets#Systemd

Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.
2.
3.
  
Actual results:


Expected results:


Additional info:
Comment 1 Jóhann B. Guðmundsson 2012-02-13 03:46:04 EST
Created attachment 561458 [details]
Native systemd service file for monotone

Let's start with this one. 

The rest of the init script needs to be split out to seperate script which the users runs by hand ( monotone-init,sh and monotone-genkey.sh montone-migrate.sh )
Comment 2 Thomas Moschny 2012-02-16 12:27:58 EST
The sysv init file does automatically create a database and a key, or moves and migrates the database if necessary upon start.

Do you see any way this can also be done using systemd?
Comment 3 Jóhann B. Guðmundsson 2012-02-16 13:08:22 EST
It can be done via two methods 

You can create a separated Type=oneshot units ( monotone-keygen.service and monotone-upgrade.service ) with or without conditions  something like...

### monotone-keygen.service ###

[Unit]
Description=Monotone Key Generator

[Service]
Type=oneshot
ExecStart=/path/to/script
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

### monotone-initialdb.service ###

[Unit]
Description=Monotone Create InitialDB

[Service]
Type=oneshot
ExecStart=/path/to/script
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

Then you would add "Wants=monotone-keygen.service monotone-upgrade.service" to the [Unit] Section and also add monotone-keygen.service monotone-initialdb.service to the After= line in the [Unit] section.

Or you can create one shell script that does all the above and add "ExecStartPre=-/path/to/script" to the [Service] section ( above the ExecStart= line ) in the monotone.service. 

Pay attention to the "-" before the / in the ExecStartPre= line if you skip it the service will fail to start if the relevant script does not exit cleanly.
Comment 4 Jóhann B. Guðmundsson 2012-02-16 13:09:49 EST
(In reply to comment #3)
> It can be done via two methods 

s/upgrade/initaldb/
Comment 5 Thomas Moschny 2012-02-20 13:29:04 EST
(In reply to comment #3)

Thanks for the comments. I think I will go that

> Or you can create one shell script that does all the above and add
> "ExecStartPre=-/path/to/script" to the [Service] section ( above the ExecStart=
> line ) in the monotone.service.

route.

> Pay attention to the "-" before the / in the ExecStartPre= line if you skip it
> the service will fail to start if the relevant script does not exit cleanly.

which might on the other hand desired, no? If creation or migration of the database is not possible, the service cannot (and thus should not try to) start.
Comment 6 Jóhann B. Guðmundsson 2012-02-20 13:48:20 EST
(In reply to comment #5)
> (In reply to comment #3) 
> > Pay attention to the "-" before the / in the ExecStartPre= line if you skip it
> > the service will fail to start if the relevant script does not exit cleanly.
> 
> which might on the other hand desired, no? If creation or migration of the
> database is not possible, the service cannot (and thus should not try to)
> start.

Yup 

But for example how are you going to handled the keygen part? surely you dont want to create keys each time the service is started and if you skip the "-" then the service would fail to start encase the keys exist ( same thing applies for the migration/upgrade) ...

You can have three separated scripts in three separated ExecStartPre= lines which should better point out to admins what failed when they run systemctl status <service> and which would allow you to use "-" where applicable.

Anyway you might want to look at how Tom solved similar problem for postgresql and mysql if I can recall correctly he simply stopped doing all this stuff in the daemon startup and pointed users to use script or run the commands by hand...
Comment 7 Jóhann B. Guðmundsson 2013-02-21 05:44:01 EST
Ping what's the current status on this?
Comment 8 Fedora End Of Life 2013-04-03 15:46:14 EDT
This bug appears to have been reported against 'rawhide' during the Fedora 19 development cycle.
Changing version to '19'.

(As we did not run this process for some time, it could affect also pre-Fedora 19 development
cycle bugs. We are very sorry. It will help us with cleanup during Fedora 19 End Of Life. Thank you.)

More information and reason for this action is here:
https://fedoraproject.org/wiki/BugZappers/HouseKeeping/Fedora19
Comment 9 Jóhann B. Guðmundsson 2014-05-26 05:42:10 EDT
Given that I have left the project and a new individual may or may not continue with systemd integration in the project by submitting new feature following whatever demands FPC and FESCo might have and thus new units in the process I'm closing this and all remaining bugs I had submitted for this particular feature as WONTFIX
Comment 10 Thomas Moschny 2016-02-15 16:21:40 EST
Fixed in rawhide: monotone-1.1-14.fc24 uses systemd instead of sysv init.

Note You need to log in before you can comment on or make changes to this bug.