start confluence as service
Asked by Bahman Sharzad:

i have confluence on ubuntu 20.04 server

i try to start as service. error message is:

bin/start-confluence.sh: line 39: /etc/init.d/user.sh: No such file or directory

bin/start-confluence.sh: line 47: /etc/init.d/startup.sh: No such file or directory


Answers:
author: Bahman Sharzad
body: i correct it with the right permission

chown -R confluence. /confluence

chown -R confluence. /var/atlassian/application-data/confluence

chmod -R 700 /confluence

chmod -R 700 /var/.../confluence

set orginal file /etc/init.d/confluence back.

comments: author: Nic Brough -Adaptavist-
body: The permissions have nothing to do with the errors you introduced into the scripts, so I'm not sure why you've done that. (and you've set them wrong too)


author: Bahman Sharzad
body: it was i found this error in my log:

all was in root owner and i gave 755 for that. as confluence user can create file in all this directory and touch catalina.....log. but enough.

error was:

Jul 23 09:35:55 "my-server" confluence\[41820\]: executing using dedicated user: confluence

Jul 23 09:35:55 "my-server" runuser\[41824\]: pam_unix(runuser:session): session opened for user confluence by (uid=0)

Jul 23 09:35:55 "my-server" confluence\[41826\]: If you encounter issues starting up Confluence, please see the Installation guide at <http://confluence.atlassian.com/display/DOC/Conf>\>

Jul 23 09:35:55 "my-server" confluence\[41826\]: Server startup logs are located in /confluence/logs/catalina.out

Jul 23 09:35:55 "my-server" confluence\[41826\]: ---------------------------------------------------------------------------

Jul 23 09:35:55 "my-server" confluence\[41826\]: Using Java: /confluence/jre//bin/java

Jul 23 09:35:56 "my-server" confluence\[41856\]: log4j:ERROR setFile(null,true) call failed.

Jul 23 09:35:56 "my-server" confluence\[41856\]: java.io.FileNotFoundException: /confluence/logs/synchrony-proxy-watchdog.log (Permission denied)

Jul 23 09:35:56 "my-server" confluence\[41856\]: at java.base/java.io.FileOutputStream.open0(Native Method)

Jul 23 09:35:56 "my-server" confluence\[41856\]: at java.base/java.io.FileOutputStream.open(Unknown Source)

Jul 23 09:35:56 "my-server" confluence\[41856\]: at java.base/java.io.FileOutputStream.\<init\>(Unknown Source)

Jul 23 09:35:56 "my-server" confluence\[41856\]: at java.base/java.io.FileOutputStream.\<init\>(Unknown Source)

Jul 23 09:35:56 "my-server" confluence\[41856\]: at org.apache.log4j.FileAppender.setFile(FileAppender.java:294)

Jul 23 09:35:56 "my-server" confluence\[41856\]: at org.apache.log4j.RollingFileAppender.setFile(RollingFileAppender.java:207)

Jul 23 09:35:56 "my-server" confluence\[41856\]: at org.apache.log4j.FileAppender.activateOptions(FileAppender.java:165)

Jul 23 09:35:56 "my-server" confluence\[41856\]: at com.atlassian.confluence.bootstrap.SynchronyProxyWatchdog.addLogFileAppender(SynchronyProxyWatchdog.java:106)

Jul 23 09:35:56 "my-server" confluence\[41856\]: at com.atlassian.confluence.bootstrap.SynchronyProxyWatchdog.main(SynchronyProxyWatchdog.java:47)

Jul 23 09:35:57 "my-server" confluence\[41856\]: 2020-07-23 09:35:57,109 INFO \[main\] \[atlassian.confluence.bootstrap.SynchronyProxyWatchdog\] A Context element for ${confluence.contex\>

Jul 23 09:35:57 "my-server" confluence\[41826\]: ---------------------------------------------------------------------------

Jul 23 09:35:57 "my-server" confluence\[41877\]: touch: cannot touch '/confluence/logs/catalina.out': Permission denied


author: Nic Brough -Adaptavist-
body: Still has nothing to do with the errors you were reporting in your question.

As it is now working, I have to assume that you corrected the path in the script as well as the permissions

(Note that I'm making this comment for the benefit of other people who may land here - I don't want future readers to think "change permissions" is the right answer to "my init scripts have the wrong path")


author: Nic Brough -Adaptavist-
body: Why have you configured your startup process to look in the wrong place for the user and startup.sh scripts?

comments: author: Bahman Sharzad
body: I install confluence in /confluence not as default under /opt/Atlasian/.../confluence

Then in start as service under /etc/init.d/confluence i found a line cd /confluence/bin

then startup .... . service failed for not to find /confluence/bin den i mark cd /... as comment

and directly looking for /confluence/bin/start-confluence.

i can startup as running ./startup under bin. but i want to start as service. and i don't change.


author: Nic Brough -Adaptavist-
body: Ok, I think I've worked out the mistake.

In your original question, you somehow seem to have modified the startup file so that it is being run thinking it is running in /etc/init.d which is not where it should be trying to run.

Your relocation of Confluence to a different directory is absolutely fine /opt/Atlassian/... is a suggested default, but I rarely see anyone who does it that way. Heck, I always install somewhere else so I can simplify backups, maintenance and upgrades on even just a $10 install!

So, you say it works ok when you use ./startup.sh, that's a good place to be.

Your mistake is not really in the confluence startup files, but your error message was misleading me.

You need to put the "cd /confluence/bin" line back into /etc/init.d/confluence

That init script needs to change directory into the "bin" directory in your Confluence installation.

The error you saw before you commented it out is, I think, because you have not installed Confluence under /confluence, you've installed it deeper than that or elsewhere.

Rather than ramble through where to look and why, there is a simple fix. Go find the startup.sh file that works ok. Change into the directory it is in, and then run "pwd"

Whatever comes back from that is what you need in the /etc/init.d/confluence file.

For example:

nic@z:#/bin$ ls startup.sh  
startup.sh  
nic@z:#/bin$ pwd  
/atlas/conf-server/bin

So my /etc/init.d/confluence file contains the "cd" line of

cd /atlas/conf-server/bin


author: Bahman Sharzad
body: i correct it with the right permission

chown -R confluence. /confluence

chown -R confluence. /var/atlassian/application-data/confluence

chmod -R 700 /confluence

chmod -R 700 /var/.../confluence

set orginal file /etc/init.d/confluence back.


Tags: confluence-server

server