Browse code

Modified nginx pid path to start service correctly And fixed nginx service to stop service correctly

Change-Id: I59693166e7af122061a70eba1925eeec0ba8ef4f
Reviewed-on: http://photon-jenkins.eng.vmware.com/1162
Tested-by: gerrit-photon <photon-checkins@vmware.com>
Reviewed-by: suezzelur <anishs@vmware.com>

dthaluru authored on 2016/07/09 07:19:16
Showing 2 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,16 @@
0
+[Unit]
1
+Description=Nginx High-performance HTTP server and reverse proxy
2
+After=network.target remote-fs.target nss-lookup.target
3
+
4
+[Service]
5
+Type=forking
6
+PIDFile=/var/run/nginx.pid
7
+ExecStartPre=/usr/sbin/nginx -t
8
+ExecStart=/usr/sbin/nginx
9
+ExecReload=/bin/kill -s HUP $MAINPID
10
+ExecStop=/bin/kill -s QUIT $MAINPID
11
+PrivateTmp=true
12
+
13
+[Install]
14
+WantedBy=multi-user.target
15
+
... ...
@@ -1,7 +1,7 @@
1 1
 Summary:	High-performance HTTP server and reverse proxy
2 2
 Name:		nginx
3 3
 Version:	1.10.0
4
-Release:	2%{?dist}
4
+Release:	3%{?dist}
5 5
 License:	BSD-2-Clause
6 6
 URL:		http://nginx.org/download/nginx-1.10.0.tar.gz
7 7
 Group:		Applications/System
... ...
@@ -9,7 +9,7 @@ Vendor:		VMware, Inc.
9 9
 Distribution: Photon
10 10
 Source0:	%{name}-%{version}.tar.gz
11 11
 %define sha1 nginx=7a452cfe37e4134481442dbfa3fbdac6f484c5bc
12
-
12
+Source1:	nginx.service
13 13
 BuildRequires:	openssl-devel
14 14
 BuildRequires:  pcre-devel
15 15
 %description
... ...
@@ -22,8 +22,8 @@ NGINX is a free, open-source, high-performance HTTP server and reverse proxy, as
22 22
 	--prefix=%{_sysconfdir}//nginx              \
23 23
 	--sbin-path=/usr/sbin/nginx                 \
24 24
 	--conf-path=/etc/nginx/nginx.conf           \
25
-	--pid-path=/var/run/nginx/nginx.pid         \
26
-	--lock-path=/var/run/nginx/nginx.lock       \
25
+	--pid-path=/var/run/nginx.pid         \
26
+	--lock-path=/var/run/nginx.lock       \
27 27
 	--error-log-path=/var/log/nginx/error.log   \
28 28
 	--http-log-path=/var/log/nginx/access.log   \
29 29
     --with-http_ssl_module \
... ...
@@ -35,25 +35,7 @@ make %{?_smp_mflags}
35 35
 make DESTDIR=%{buildroot} install
36 36
 install -vdm755 %{buildroot}/usr/lib/systemd/system
37 37
 install -vdm755 %{buildroot}%{_var}/log/nginx
38
-install -vdm755 %{buildroot}%{_var}/run/nginx
39
-
40
-cat << EOF >> %{buildroot}/usr/lib/systemd/system/nginx.service
41
-[Unit]
42
-Description=Nginx High-performance HTTP server and reverse proxy
43
-After=network.target remote-fs.target nss-lookup.target
44
-
45
-[Service]
46
-Type=forking
47
-PIDFile=/var/run/nginx/nginx.pid
48
-ExecStartPre=/usr/sbin/nginx -t
49
-ExecStart=/usr/sbin/nginx
50
-ExecReload=/bin/kill -s HUP $MAINPID
51
-ExecStop=/bin/kill -s QUIT $MAINPID
52
-PrivateTmp=true
53
-[Install]
54
-WantedBy=multi-user.target
55
-
56
-EOF
38
+install -p -m 0644 %{SOURCE1} %{buildroot}/usr/lib/systemd/system/nginx.service
57 39
 
58 40
 %check
59 41
 make -k check |& tee %{_specdir}/%{name}-check-log || %{nocheck}
... ...
@@ -63,10 +45,11 @@ make -k check |& tee %{_specdir}/%{name}-check-log || %{nocheck}
63 63
 %{_sysconfdir}/*
64 64
 %{_sbindir}/*
65 65
 %{_libdir}/*
66
-%{_var}/log/nginx
67
-%{_var}/run/nginx
66
+%dir %{_var}/log/nginx
68 67
 
69 68
 %changelog
69
+*   Fri Jul 8 2016 Divya Thaluru<dthaluru@vmware.com> 1.10.0-3
70
+-   Modified default pid filepath and fixed nginx systemd service
70 71
 *	Tue May 24 2016 Priyesh Padmavilasom <ppadmavilasom@vmware.com> 1.10.0-2
71 72
 -	GA - Bump release of all rpms
72 73
 *   Mon May 16 2016 Xiaolin Li <xiaolinl@vmware.com> 1.10.0-1