[mongodb] Switch mongodb over to using a native systemd service file.
Chris Lalancette
clalance at fedoraproject.org
Fri Jul 22 14:03:25 UTC 2011
commit d4439af280996e7eb96bae38cdc937da7a23bdef
Author: Chris Lalancette <clalance at redhat.com>
Date: Fri Jul 22 09:03:44 2011 -0400
Switch mongodb over to using a native systemd service file.
Signed-off-by: Chris Lalancette <clalance at redhat.com>
mongod.service | 14 ++++++++
mongod.sysconf | 1 +
mongodb.init | 93 --------------------------------------------------------
mongodb.spec | 40 ++++++++++--------------
4 files changed, 32 insertions(+), 116 deletions(-)
---
diff --git a/mongod.service b/mongod.service
new file mode 100644
index 0000000..543c74c
--- /dev/null
+++ b/mongod.service
@@ -0,0 +1,14 @@
+[Unit]
+Description=High-performance, schema-free document-oriented database
+After=syslog.target network.target
+
+[Service]
+Type=forking
+User=mongodb
+PIDFile=/var/run/mongodb.pid
+EnvironmentFile=/etc/sysconfig/mongod
+ExecStart=/usr/bin/mongod $OPTIONS run
+ExecStop=/bin/kill -TERM $MAINPID
+
+[Install]
+WantedBy=multi-user.target
diff --git a/mongod.sysconf b/mongod.sysconf
new file mode 100644
index 0000000..7614052
--- /dev/null
+++ b/mongod.sysconf
@@ -0,0 +1 @@
+OPTIONS="--quiet -f /etc/mongodb.conf"
diff --git a/mongodb.spec b/mongodb.spec
index b49d5aa..8d8bd64 100644
--- a/mongodb.spec
+++ b/mongodb.spec
@@ -1,10 +1,7 @@
-# Make sure initddir is defined on el5 and possibly other distros
-%{!?_initddir: %define _initddir %{_initrddir}}
-
%global daemon mongod
Name: mongodb
Version: 1.8.2
-Release: 3%{?dist}
+Release: 4%{?dist}
Summary: High-performance, schema-free document-oriented database
Group: Applications/Databases
License: AGPLv3 and zlib and ASL 2.0
@@ -14,12 +11,12 @@ License: AGPLv3 and zlib and ASL 2.0
URL: http://www.mongodb.org
Source0: http://fastdl.mongodb.org/src/%{name}-src-r%{version}.tar.gz
-Source1: %{name}.init
-Source2: %{name}.logrotate
-Source3: %{name}.conf
+Source1: %{daemon}.service
+Source2: %{daemon}.sysconf
+Source3: %{name}.logrotate
+Source4: %{name}.conf
Patch1: mongodb-no-term.patch
Patch2: mongodb-src-r1.8.2-js.patch
-BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: python-devel
BuildRequires: scons
@@ -125,20 +122,18 @@ scons install . \
rm -f %{buildroot}%{_libdir}/libmongoclient.a
mkdir -p %{buildroot}%{_sharedstatedir}/%{name}
-
mkdir -p %{buildroot}%{_localstatedir}/log/%{name}
-install -p -D -m 755 %{SOURCE1} %{buildroot}%{_initddir}/%{daemon}
-install -p -D -m 644 %{SOURCE2} %{buildroot}%{_sysconfdir}/logrotate.d/%{name}
-install -p -D -m 644 %{SOURCE3} %{buildroot}%{_sysconfdir}/mongodb.conf
+mkdir -p %{buildroot}/lib/systemd/system
+mkdir -p %{buildroot}%{_sysconfdir}/sysconfig
+
+install -p -D -m 644 %{SOURCE1} %{buildroot}/lib/systemd/system/%{daemon}.service
+install -p -D -m 644 %{SOURCE2} %{buildroot}%{_sysconfdir}/sysconfig/%{daemon}
+install -p -D -m 644 %{SOURCE3} %{buildroot}%{_sysconfdir}/logrotate.d/%{name}
+install -p -D -m 644 %{SOURCE4} %{buildroot}%{_sysconfdir}/mongodb.conf
mkdir -p %{buildroot}%{_mandir}/man1
cp -p debian/*.1 %{buildroot}%{_mandir}/man1/
-mkdir -p %{buildroot}%{_localstatedir}/run/%{name}
-
-%clean
-rm -rf %{buildroot}
-
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
@@ -168,7 +163,6 @@ fi
%files
-%defattr(-,root,root,-)
%{_bindir}/mongo
%{_bindir}/mongodump
%{_bindir}/mongoexport
@@ -190,28 +184,28 @@ fi
%{_mandir}/man1/mongorestore.1*
%files -n lib%{name}
-%defattr(-,root,root,-)
%doc README GNU-AGPL-3.0.txt APACHE-2.0.txt
%{_libdir}/libmongoclient.so
%files server
-%defattr(-,root,root,-)
-%{_initddir}/%{daemon}
%{_bindir}/mongod
%{_bindir}/mongos
%{_mandir}/man1/mongod.1*
%{_mandir}/man1/mongos.1*
%dir %attr(0755, %{name}, root) %{_sharedstatedir}/%{name}
%dir %attr(0755, %{name}, root) %{_localstatedir}/log/%{name}
-%dir %attr(0755, %{name}, root) %{_localstatedir}/run/%{name}
%config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
%config(noreplace) %{_sysconfdir}/mongodb.conf
+%config(noreplace) %{_sysconfdir}/sysconfig/%{daemon}
+/lib/systemd/system/*.service
%files devel
-%defattr(-,root,root,-)
%{_includedir}/mongo
%changelog
+* Thu Jul 21 2011 Chris Lalancette <clalance at redhat.com> - 1.8.2-4
+- Update to use systemd init
+
* Thu Jul 21 2011 Chris Lalancette <clalance at redhat.com> - 1.8.2-3
- Rebuild for boost ABI break
More information about the scm-commits
mailing list