Jive-messengerd

Hi,

So i want to run JM as daemon on my linux box. I know that developers have tested this with FC3. I’'m using Archlinux 0.7, so maybe there are some differences between distros or some other tricks, but i cant make it work.

I’'m using 2.1.1 version overwritten by latest daily build. “./messenger start” works fine. Then i copy jive-messengerd to my /etc/rc.d directory (there is no init.d directoy in arch, so i think this is the place i should use instead). There are other daemons in this directory, and there is a line in /etc/rc.conf file for running daemons. So i put jive-messengerd to my rc.conf in DAEMONS part. I have not “jive” user, so i have edited jive-messengerd and written other user instead, havent tested with “jive” user yet. JM server is not starting at boot. And i get error at boot and reboot, wich says that i have no JVM 1.5 or i have to clean install4j cache in some folder. But there is no such folder in that direction.

So, all who are using JM with linux and devs of course, maybe you’'ll give me some advices?

I’‘m not familiar with Archlinux, but some distros don’'t have a full environment for their startup scripts.

messenger.sh tries to look at MESSENGER_HOME and JAVA_HOME to figure out where to bootstrap from. If the java binary is not in your system PATH, try setting JAVA_HOME explicity at the top of messenger.sh.

You can always use logger which comes with util-linux (included with almost every distro) to debug where the script is failing. It will let you log info to your syslog so you can check your /var/log/messages.

e.g. logger -t “jive” “java home: $JAVA_HOME”

Sprinkle a couple of those in messenger.sh and you should see where it’'s failing.

If you can start messenger when you log into a shell without having to export any environment variables, it probably means you have some settings in /etc/profile which sets either JAVA_HOME or puts the java binary in your PATH.

Rob

well, i’‘m a novice with *nix system. Especially with environment variables. But you are talking about messenger.sh Do i really have to use this? I’'m looking at instructions inside of jive-messengerd. And this part confuses me:

  1. Link to the directory as follows

  2. cd /etc/rc.d

  3. ln -s …/init.d/jive-messengerd $90jive-messengerd

As i said, there is no init.d directory in Arch, and rc.d too. There is only one rc.d directory. So i’‘m not sure there to link jive-messengerd. Well, maybe i’'ll have to ask more questions in Arch forum.

Thank you for you advice with util-linux, but i’‘m not sure if i have to use it, because i think i’‘m not using messenger.sh. There is no line about JAVA in /etc/profile, but it points to /etc/profile.d dir, there is j2re.sh in this dir. I’'ll give you the content of my profile and j2re.sh in next post.

One more thing, when i chmod +x jive-messengerd and try this: ./jive-messengerd start

Jive server starts normally.

  1. /etc/profile

export PATH="/bin:/usr/bin:/sbin:/usr/sbin:/usr/X11R6/bin:/opt/bin"

export MANPATH="/usr/man:/usr/X11R6/man"

export LESSCHARSET=“latin1”

export INPUTRC="/etc/inputrc"

export LESS="-R"

  1. Locale settings (find your locale with ‘‘locale -a’’)

export LANG=“en_US”

export LC_COLLATE=“C”

export COLUMNS LINES

export PS1=’’[\u@\h \W]$ ‘’

export PS2=’’> ‘’

umask 022

if [ “$TERM” = “xterm” -o “$TERM” = “xterm-color” -o “$TERM” = “rxvt” -o “$TERM” = “xterm-xfree86” ]; then

PROMPT_COMMAND=’‘echo -ne “\033]0;$The specified item was not found.@${HOSTNAME%%.*}:${PWD/$HOME/~}\007”’’

fi

  1. load profiles from /etc/profile.d

  2. (to disable a profile, just remove execute permission on it)

for profile in /etc/profile.d/*.sh; do

if ; then

. $profile

fi

done

unset profile

  1. End of file

  1. /etc/profile.d/j2re.sh

export J2REDIR=/opt/java/jre

export PATH=$PATH:$J2REDIR/bin

export MANPATH=$MANPATH:$J2REDIR/man

export CLASSPATH=$CLASSPATH:$J2REDIR/lib

if ; then

export JAVA_HOME=/opt/java/jre

fi

chmod +x would be necessary for the script to run at boot.

Have you tried running “/etc/rc.d/jive-messengerd start” ? (keeping the exec bit on)

What does “ls -l /etc/rc.d” look like?

The file should be owned by root, and read and executable by everyone else:

-rwxr-xr-x …jive-messengerd

Looks like your java environment is being set by your os, but as long as you have $MESSENGER_HOME/jre the messenger script works.

Are you in /etc/rc.d when you exec “./jive-messengerd start” ?

When it works like that is it run as the jive user?

It sounds to me like an executable/permission issue. Any shell script needs read and execute permissions for the user to run.

As long as your have the above permissions set on /etc/rc.d/jive-messengerd , it should work.

Regards,

Rob

Just another assumption:

I don’‘t use Arch linux, but the rc.conf idea is not really new. I guess you can set up the order of services to start? You write something about a “daemon” part of the config where you’'d like to add the jive-messengerd script.

The big difference between your test as user(root/whoever) and the system startup is, that your user has already an environment (like $HOME, $JAVA_HOME etc…) while I suspect your startup scripts don’‘t (not logged in, /etc/profile isn’'t read yet etc.).

If you don’'t mind losing a little flexibility just add something like

export JAVA_HOME=/path/to/java

and/or

export MESSENGER_HOME=/path/to/messenger

to the start of the jive-messengerd script - that should do the trick. If it won’'t work, please give an error message with a little more details.

Ben

chmod +x would be necessary for the script to run at

boot.

yes, i have chmoded it already

Have you tried running "/etc/rc.d/jive-messengerd

start" ? (keeping the exec bit on)

this starts the server, but i cant connect to Admin Console, it says:

“Setup was able to find your conf directory but does not have write permission on it. Please alter the directory permissions.”

So i have give permissions for jive user to rw this file? How about DB?

What does “ls -l /etc/rc.d” look like?

The file should be owned by root, and read and

executable by everyone else:

-rwxr-xr-x …jive-messengerd

-rwxr-xr-x 1 root root … jive-messengerd

is this ok? is there such way/switch to give some rights to given user? I dont undestand chmod syntax (only chmod +x), and chmod man page do not help me.

Looks like your java environment is being set by your

os, but as long as you have $MESSENGER_HOME/jre the

messenger script works.

hmm… i have tried to copy /opt/java/jre to /opt/jive_messenger No result. Windows version works w/o JRE folder in jive_messenger, switches to system Java.

Are you in /etc/rc.d when you exec "./jive-messengerd

start" ?

When it works like that is it run as the jive user?

with jive user it says:

standard in must be a tty

have no clue

It sounds to me like an executable/permission issue.

Any shell script needs read and execute permissions

for the user to run.

yes i know about this, but it seems to difficult for me. If i can found so manual with clear explanation about setting permissions.

As long as your have the above permissions set on

/etc/rc.d/jive-messengerd , it should work.

no for me:)

could you give me more detailed explanation step-by-step how are you setting Jive on you machine? Or how you think it should be on mine, keeping in mind my vars:

/etc/profile

/etc/rc.d

/opt/java/jre/bin

/opt/jive_messenger

/etc/rc.conf (with DAEMONS part to load daemons on boot)

or maybe Arch is just not compatible with this deamon or vice versa.

P.S. in other forum i was told to put /opt/java/bin in my /etc/profile I have tried combinations:

export PATH="/bin:/usr/bin:/sbin:/usr/sbin:/usr/X11R6/bin:/opt/bin:/opt/

java/jre"

export PATH="/bin:/usr/bin:/sbin:/usr/sbin:/usr/X11R6/bin:/opt/bin:/opt/

java/jre/bin"

No result.

OK, we’'re getting somewhere.

Definitely looks like permissions.

e.g.

-rwxr-xr-x 1 root root … jive-messengerd

this states that the root user and root group owns the file, the owning user can rwx and group and other can only rx.

unix permissions are set as follows:

r=4,w=2,x=1

if you “chown root:root jive-messengerd && chmod 755 jive-messengerd” you will end up with the permissions above. You want root to own the file, but anyone else (like the jive user) to read and execute it.

Looks like the jive user can’'t write into the conf directory.

Recursively change ownership to user jive and group jive:

“chown -R jive:jive /opt/jive_messenger”

Try that to make sure jive has access to the directory.

To test it, as root switch user to jive using “su - jive” cd into MESSENGER_HOME and “touch conf/test”

You should be able to write a test file as the jive user.

In production for security sake, the jive binaries directories should probably be owned as root:root with write access in conf and logs for the jive user.

As far as the jre goes, the full install of jive messenger bundles the jre into MESSENGER_HOME/jre. If you’‘re overwriting the stable release with a nightly build it should still be there however, that doesn’'t look like the issue.

Regards,

Rob

OK, so you’'ve both managed to solve my issue:)

yes, export JAVA_HOME=/opt/java/jre in top of jive-messengerd did the trick. No server starts at boot. The only nasty thing is these server output lines at login screen (“Server started bla bla…”):slight_smile: But i have no health to fight with these too:) I’‘ve tried to uncomment INSTALL4J_JAVA_HOME_OVERRIDE= line in /opt/jive_messenger/bin/messenger and put /opt/java/jre in there. This works too, but i think it’‘s better to edit daemon and not the main script. Maybe i’‘m loosing some flexibility, but it’‘s ok, i’'t will be Jive only dedicated server:)

And of course Rob:) Thanx a lot for you explanations, it’'s now more clear to me. So chmod have the same(user:group) syntax? Anyway, i have chowned /conf and /logs dirs to jive user, the rest is owned by root. And it works fine, as it seems:)

Now the only thing has left - SSH, but i’'ll found out this by myself or in my native IT forum.

Again, thanx a lot guys:)

P.S. there is no JRE dir in jive_messenger_2_1_1.tar.gz

well, it seems i cant mark two Correct answers in one thread:) And i cant take my mark back:) It could be better to mark Ben’‘s answer as correct and two Rob’'s answers as Helpful. Heh:)

well, some new probs, as always.

i have found that there was root user defined in jive-messengerd script and not the jive user. So now i have changed it to jive, chowned recursively /conf and /logs dirs to jive user. But server was not starting correctly. As i undestand DB must be opened for writing for jive user too, cause im using embedded-db. So i have chowned this dir to jive user too. Now server startups, and works. And i can connect to Admin Console, browse it and change settings. But i cant get logs page. Error:

HTTP ERROR: 500

Internal Server Error

RequestURI=/logviewer.jsp

Powered by Jetty://

So, permission problems again?

maybe it’'s a problem with nohup.out

because it writes to /home/jive/nohup.out

if i chown whole jive_messenger dit to jive user, it writes nohup.out to default place and log page works. So i shoukld probably chown this file to jive user too?

Message was edited by:

wroot

Found out:) Have to chown main jive_messenger dir (not recursively) to jive user too. Some inherits i think.