Unable to start jira using a cron job

Anthony Kong November 27, 2011

I am using jira v4.4.1#660-r161644 on a linux server (kernel: 2.6.9-67.ELhugemem) at the moment

I have created a custom script to start jira. it isschedule to run it once a week in crontab because our development server reboot weekly.

#!/bin/bash

JIRAHOME=~/atlassian/jira
$JIRAHOME/bin/start-jira.sh

However the jira server is not started. If I run this command manually in shell it works just fine.

I have checked the cron log and I am sure the script get executed at the scheduled time. The x flag of the script is set and the path is correct.

What can cause this to happend?

EDIT

Will it help if I pass a -fg parameter to the command?


4 answers

1 accepted

1 vote
Answer accepted
Anthony Kong January 24, 2012

Turns out it has somthing to do with the cron job definition

I have this line in cron job

30 06 * * 1-5 /home/uat/bin/jira.start >> ~/logs/cron.`date +YYMMDD`.log

(It is not exactly YYMMDD but I have forgot to keep a record of the old cron line)

Somehow changing it to this one solve the problem

30 06 * * 1-5 /home/uat/bin/jira.start >> ~/logs/cron.`date +\%Y-\%m-\%d`.log

So it is not a problem within the script itself.

0 votes
Nabil Sayegh
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 13, 2015

You need to set either JAVA_HOME or JRE_HOME in the crontab. Your .profile is being ignored by cron.

0 votes
Jobin Kuruvilla [Adaptavist]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 27, 2011

Did you check the user permissions?

Anthony Kong November 27, 2011

Yes. When I said I have run it in shell, I have actually su into the relevant account beforehand.

0 votes
Aspect Infra Team
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 27, 2011

under what user this cronjob are?
looks like something wrong with a path

try as example

#!/bin/bash

cd /(real path to jira home)/atlassian/jira
./bin/start-jira.sh

Anthony Kong November 27, 2011

Good suggestion. Will give it a go

Suggest an answer

Log in or Sign up to answer