Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

JIRA cloud daily backup

Brahim ESSALIH
Contributor
October 25, 2016

Hi everybody,

I have an instance JIRA cloud and I need to schedule it's backup (for example one time every 2 days) without do it manually.

Would you have any idea ?

Best regards

1 answer

0 votes
Nic Brough -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.
October 25, 2016
Brahim ESSALIH
Contributor
October 25, 2016

Thanks @Nic Brough [Adaptavist] I try there shell script but it still displaying this error

cannot remove 'jiracookie': No such file or directory

 

this the script source code:

#!/bin/bash
USERNAME=user
PASSWORD=pass
INSTANCE=https://my-instance.atlassian.net
LOCATION='C:\Backups'
# Set this to your Atlassian instance's timezone.
# See this for a list of possible values:
# https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
TIMEZONE=America/Los_Angeles
 
# Grabs cookies and generates the backup on the UI. 
TODAY=`TZ=$TIMEZONE date +%Y%m%d`
COOKIE_FILE_LOCATION=jiracookie
curl --silent -u $USERNAME:$PASSWORD --cookie-jar $COOKIE_FILE_LOCATION https://${INSTANCE}/Dashboard.jspa --output /dev/null
BKPMSG=`curl -s --cookie $COOKIE_FILE_LOCATION --header "X-Atlassian-Token: no-check" -H "X-Requested-With: XMLHttpRequest" -H "Content-Type: application/json"  -X POST https://${INSTANCE}/rest/obm/1.0/runbackup -d '{"cbAttachments":"true" }' `
rm $COOKIE_FILE_LOCATION
 
#Checks if the backup procedure has failed
if [ `echo $BKPMSG | grep -i backup | wc -l` -ne 0 ]; then
#The $BKPMSG variable will print the error message, you can use it if you're planning on sending an email
exit
fi
 
#Checks if the backup exists in WebDAV every 10 seconds, 20 times. If you have a bigger instance with a larger backup file you'll probably want to increase that.
for (( c=1; c<=20; c++ ))
do
wget --user=$USERNAME --password=$PASSWORD --spider https://${INSTANCE}/webdav/backupmanager/JIRA-backup-${TODAY}.zip >/dev/null 2>/dev/null || OK=$?
OK=$?
if [ $OK -eq 0 ]; then
break
fi
sleep 10
done
 
#If after 20 attempts it still fails it ends the script.
if [ $OK -ne 0 ];
then
exit
else
 
#If it's confirmed that the backup exists on WebDAV the file get's copied to the $LOCATION directory.
wget --user=$USERNAME --password=$PASSWORD -t 0 --retry-connrefused https://${INSTANCE}/webdav/backupmanager/JIRA-backup-${TODAY}.zip -P "$LOCATION" >/dev/null 2>/dev/null
fi
Nic Brough -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.
October 26, 2016

That's just a warning that the file isn't there.

Suggest an answer

Log in or Sign up to answer