Can I run sudo service restart on stash?

Given that stash is run as a service, a question came up - can we run "sudo service stash restart" rather than the bin/stop-stash.sh bin/start-stash.sh scripts as documented here:

https://confluence.atlassian.com/display/STASH/Starting+and+stopping+Stash

The question is - will this action effectively do the same thing?

1 answer

1 accepted

Hi Mike, if you have installed Stash using our Linux installed and selected the option to create a service, then you should have a bash script like the following one at /etc/init.d

#!/usr/bin/env bash
### BEGIN INIT INFO
# Provides:          stash
# Required-Start:
# Required-Stop:
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start Stash daemon at boot time
# Description:       Start Stash daemon at boot time
### END INIT INFO

# THIS SCRIPT HAS BEEN CONFIGURED TO RUN AS PART OF RUN LEVELS 2 TO 5
# IF YOU WISH TO CHANGE THIS CONFIGURATION YOU WILL HAVE TO DO IT MANUALLY

start() {
    ./start-stash.sh
}

stop() {
    ./stop-stash.sh
}

# STASH Linux service controller script
cd /opt/atlassian/stash/install/bin

case "$1" in
    start)
        start
        ;;
    stop)
        stop
        ;;
    restart)
        stop
        start
        ;;
    *)
        echo "Usage: $0 {start|stop}"
        exit 1
        ;;
esac

The default name of this service is atlstash, so it means that you can call it using service atlstash restart and it'll work exactly the same way as the scripts in this doc.

If you execute sudo service atlstash restart it means that you'll use the root user. It's not necessarily a problem, you just need to pay attention to the file system permission on Stash file and folders.

I hope it helps.

Cheers

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Jun 12, 2018 in Bitbucket

Do you use any Atlassian products for your personal projects?

After spinning my wheels trying to get organized enough to write a book for National Novel Writing Month (NaNoWriMo) I took my affinity for Atlassian products from my work life and decided to tr...

29,779 views 26 12
Join discussion

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you