It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Automatic startup service on CentOS 7 Edited

Hello. How can I add to startup service Confluence on CentOS 7? After restarting the server, the service does not start.

 

P.S. This solution is not work

1 answer

0 votes

Hello there,

Welcome to Atlassian Community! It's nice to have you.

To run Confluence as a service on Linux, you must use sudo to run the installer to be able to install Confluence as a service. The installer will create a dedicated user account, confluence, that will run the service.

Can you confirm that you used sudo to run the installer? Are you getting any error messages when the service tries to start?

Regards,

Shannon

I tried to run this script, but I get an error:

[root@confluence user]# su - root
[root@confluence ~]# cd /opt/atlassian/confluence/bin/
[root@confluence bin]# sudo sh install_linux_service.sh
installing Confluence as a service
which: no update-rc.d in (/sbin:/bin:/usr/sbin:/usr/bin)
ln: failed to create symbolic link «/etc/rc0.d/K95confluence1»: File exists
ln: failed to create symbolic link «/etc/rc1.d/K95confluence1»: File exists
ln: failed to create symbolic link «/etc/rc2.d/S95confluence1»: File exists
ln: failed to create symbolic link «/etc/rc3.d/S95confluence1»: File exists
ln: failed to create symbolic link «/etc/rc4.d/S95confluence1»: File exists
ln: failed to create symbolic link «/etc/rc5.d/S95confluence1»: File exists
ln: failed to create symbolic link «/etc/rc6.d/K95confluence1»: File exists
[root@confluence bin]#

 

I tried to create a file:
/lib/systemd/system/confluence.service

 

with content:

 

[Unit]
Description=Confluence
After=network.target

[Service]
Type=forking
User=confluence
PIDFile=/opt/atlassian/confluence/work/catalina.pid
ExecStart=/opt/atlassian/confluence/bin/start-confluence.sh
ExecStop=/opt/atlassian/confluence/bin/stop-confluence.sh
TimeoutSec=200
LimitNOFILE=4096
LimitNPROC=4096

 

 

[Install]
WantedBy=multi-user.target

[root@confluence system]# systemctl daemon-reload

[root@confluence system]# systemctl enable confluence.service
Failed to execute operation: File exists

[root@confluence system]# systemctl start confluence.service
Job for confluence.service failed because the control process exited with error code. See "systemctl status confluence.service" and "journalctl -xe" for details.

[root@confluence system]# systemctl status confluence.service
● confluence.service - Confluence
Loaded: loaded (/etc/systemd/system/confluence.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Вт 2019-10-15 04:36:46 MSK; 2s ago
Process: 1498 ExecStart=/opt/atlassian/confluence/bin/start-confluence.sh (code=exited, status=1/FAILURE)

окт 15 04:36:46 confluence.loc systemd[1]: Starting Confluence...
окт 15 04:36:46 confluence.loc start-confluence.sh[1498]: To run Confluence in the foreground, start the server with start-confluence.sh -fg
окт 15 04:36:46 confluence.loc systemd[1]: confluence.service: control process exited, code=exited status=1
окт 15 04:36:46 confluence.loc systemd[1]: Failed to start Confluence.
окт 15 04:36:46 confluence.loc systemd[1]: Unit confluence.service entered failed state.
окт 15 04:36:46 confluence.loc systemd[1]: confluence.service failed.
[root@confluence system]#

[root@confluence system]# journalctl -xe
-- Главный процесс нового сеанса имеет индентификатор 1313.
окт 15 04:24:11 confluence.loc sshd[1313]: pam_unix(sshd:session): session opened for user user by (uid=0)
окт 15 04:24:15 confluence.loc su[1337]: (to root) user on pts/0
окт 15 04:24:15 confluence.loc su[1337]: pam_unix(su:session): session opened for user root by user(uid=1000)
окт 15 04:24:42 confluence.loc su[1350]: (to root) user on pts/0
окт 15 04:24:42 confluence.loc su[1350]: pam_unix(su-l:session): session opened for user root by user(uid=0)
окт 15 04:35:09 confluence.loc polkitd[723]: Registered Authentication Agent for unix-process:1430:202873 (system bus name :1.27 [/usr/bin/pkttyagent --notify-fd 5 --fallback], object path /org/freedesktop/PolicyKit1/AuthenticationAgent,
окт 15 04:35:09 confluence.loc systemd[1]: Reloading.
окт 15 04:35:09 confluence.loc systemd[1]: [/etc/systemd/system/node_exporter.service:10] Unknown lvalue 'ExecLoad' in section 'Service'
окт 15 04:35:09 confluence.loc polkitd[723]: Unregistered Authentication Agent for unix-process:1430:202873 (system bus name :1.27, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale ru_RU.UTF-8) (disconnected from bus)
окт 15 04:35:13 confluence.loc polkitd[723]: Registered Authentication Agent for unix-process:1448:203290 (system bus name :1.28 [/usr/bin/pkttyagent --notify-fd 5 --fallback], object path /org/freedesktop/PolicyKit1/AuthenticationAgent,
окт 15 04:35:13 confluence.loc polkitd[723]: Unregistered Authentication Agent for unix-process:1448:203290 (system bus name :1.28, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale ru_RU.UTF-8) (disconnected from bus)
окт 15 04:35:20 confluence.loc polkitd[723]: Registered Authentication Agent for unix-process:1454:203906 (system bus name :1.29 [/usr/bin/pkttyagent --notify-fd 5 --fallback], object path /org/freedesktop/PolicyKit1/AuthenticationAgent,
окт 15 04:35:20 confluence.loc systemd[1]: Starting Confluence...
-- Subject: Начинается запуск юнита confluence.service
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Начат процесс запуска юнита confluence.service.
окт 15 04:35:20 confluence.loc start-confluence.sh[1460]: To run Confluence in the foreground, start the server with start-confluence.sh -fg
окт 15 04:35:20 confluence.loc start-confluence.sh[1460]: Confluence has been installed to run as confluence1 so please sudo run this to enable switching to that user
окт 15 04:35:20 confluence.loc systemd[1]: confluence.service: control process exited, code=exited status=1
окт 15 04:35:20 confluence.loc systemd[1]: Failed to start Confluence.
-- Subject: Ошибка юнита confluence.service
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Произошел сбой юнита confluence.service.
--
-- Результат: failed.
окт 15 04:35:20 confluence.loc systemd[1]: Unit confluence.service entered failed state.
окт 15 04:35:20 confluence.loc systemd[1]: confluence.service failed.
окт 15 04:35:20 confluence.loc polkitd[723]: Unregistered Authentication Agent for unix-process:1454:203906 (system bus name :1.29, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale ru_RU.UTF-8) (disconnected from bus)
окт 15 04:36:39 confluence.loc polkitd[723]: Registered Authentication Agent for unix-process:1468:211874 (system bus name :1.30 [/usr/bin/pkttyagent --notify-fd 5 --fallback], object path /org/freedesktop/PolicyKit1/AuthenticationAgent,
окт 15 04:36:39 confluence.loc systemd[1]: Reloading.
окт 15 04:36:39 confluence.loc systemd[1]: [/etc/systemd/system/node_exporter.service:10] Unknown lvalue 'ExecLoad' in section 'Service'
окт 15 04:36:39 confluence.loc polkitd[723]: Unregistered Authentication Agent for unix-process:1468:211874 (system bus name :1.30, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale ru_RU.UTF-8) (disconnected from bus)
окт 15 04:36:43 confluence.loc polkitd[723]: Registered Authentication Agent for unix-process:1486:212229 (system bus name :1.31 [/usr/bin/pkttyagent --notify-fd 5 --fallback], object path /org/freedesktop/PolicyKit1/AuthenticationAgent,
окт 15 04:36:43 confluence.loc polkitd[723]: Unregistered Authentication Agent for unix-process:1486:212229 (system bus name :1.31, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale ru_RU.UTF-8) (disconnected from bus)
окт 15 04:36:46 confluence.loc polkitd[723]: Registered Authentication Agent for unix-process:1492:212570 (system bus name :1.32 [/usr/bin/pkttyagent --notify-fd 5 --fallback], object path /org/freedesktop/PolicyKit1/AuthenticationAgent,
окт 15 04:36:46 confluence.loc systemd[1]: Starting Confluence...
-- Subject: Начинается запуск юнита confluence.service
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Начат процесс запуска юнита confluence.service.
окт 15 04:36:46 confluence.loc start-confluence.sh[1498]: To run Confluence in the foreground, start the server with start-confluence.sh -fg
окт 15 04:36:46 confluence.loc start-confluence.sh[1498]: Confluence has been installed to run as confluence1 so please sudo run this to enable switching to that user
окт 15 04:36:46 confluence.loc systemd[1]: confluence.service: control process exited, code=exited status=1
окт 15 04:36:46 confluence.loc systemd[1]: Failed to start Confluence.
-- Subject: Ошибка юнита confluence.service
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Произошел сбой юнита confluence.service.
--
-- Результат: failed.
окт 15 04:36:46 confluence.loc systemd[1]: Unit confluence.service entered failed state.
окт 15 04:36:46 confluence.loc systemd[1]: confluence.service failed.
окт 15 04:36:46 confluence.loc polkitd[723]: Unregistered Authentication Agent for unix-process:1492:212570 (system bus name :1.32, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale ru_RU.UTF-8) (disconnected from bus)

But I can run this application manually:

[root@confluence system]# cd /opt/atlassian/confluence/bin/
[root@confluence bin]# sh start-confluence.sh

To run Confluence in the foreground, start the server with start-confluence.sh -fg
executing using dedicated user: confluence1
If you encounter issues starting up Confluence, please see the Installation guide at http://confluence.atlassian.com/display/DOC/Confluence+Installation+Guide

Server startup logs are located in /opt/atlassian/confluence/logs/catalina.out
---------------------------------------------------------------------------
Using Java: /opt/atlassian/confluence/jre//bin/java
2019-10-15 04:44:08,923 INFO [main] [atlassian.confluence.bootstrap.SynchronyProxyWatchdog] A C ontext element for ${confluence.context.path}/synchrony-proxy is found in /opt/atlassian/conflu ence/conf/server.xml. No further action is required
---------------------------------------------------------------------------
Using CATALINA_BASE: /opt/atlassian/confluence
Using CATALINA_HOME: /opt/atlassian/confluence
Using CATALINA_TMPDIR: /opt/atlassian/confluence/temp
Using JRE_HOME: /opt/atlassian/confluence/jre/
Using CLASSPATH: /opt/atlassian/confluence/bin/bootstrap.jar:/opt/atlassian/confluence/bi n/tomcat-juli.jar
Using CATALINA_PID: /opt/atlassian/confluence/work/catalina.pid
Tomcat started.
[root@confluence bin]#


...and after a few minutes service is starting.

Hello,

Thank you for sharing those details.

The initial error you were getting (failed to get symbolic link) can be ignored; it's expecting init.d there.

The error we want to focus on is this one:

[/etc/systemd/system/node_exporter.service:10] Unknown lvalue 'ExecLoad' in section 'Service'

There's some value ExecLoad that isn't expected. This isn't in the Service file as instructed in the article (Run Confluence as a systemd service) so it might be somewhere else in your file.

Can you confirm you ran the following to create the file, and then edit as root? 

touch /lib/systemd/system/confluence.service
chmod 664 /lib/systemd/system/confluence.service

If so, can you please include the contents of the entire file? 

Regards,

Shannon

Hello. Yes, i created this file (confluence.service) with this solution and with root privilegies and changed it as root user (sorry for my bad english). And i can show this file:


[root@confluence system]# cat /lib/systemd/system/confluence.service

[Unit]
Description=Confluence
After=network.target

[Service]
Type=forking
User=confluence
PIDFile=/opt/atlassian/confluence/work/catalina.pid
ExecStart=/opt/atlassian/confluence/bin/start-confluence.sh
ExecStop=/opt/atlassian/confluence/bin/stop-confluence.sh
TimeoutSec=200
LimitNOFILE=4096
LimitNPROC=4096

[Install]
WantedBy=multi-user.target

I don't quite understand how Confluence works and why the user confluence1 appears in the logs.

[root@confluence system]# ls -l
<...>
-rw-rw-r-- 1 root root 347 окт 16 02:45 confluence.service

Hello,

Thank you for confirming that, and for pointing out the additional Confluence user. This can happen if you've done more than one installation of Confluence on this server

Could you change your username in the Service file to match? (i.e. User=confluence1) Let me know if that helps.

Regards,

Shannon

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Posted in Confluence

What project did you transition or start on Confluence with the shift to remote work?

It’s been great to hear from fellow users over the last few weeks about the best tips and fun moments you’ve had working on Confluence since the transition to working remote. I’d love to keep the c...

109 views 3 7
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you