Adding init.d script (=service) for unicorn
[gitorious:ce-installer.git] / modules / gitorious / templates / usr / bin / restart_gitorious.erb
1 #!/bin/sh
2 status_message() {
3     printf "%-50s \033[1;32m %s \033[0m\n" "Restarting $1" [OK]
4 }
5
6 reload_unicorn() {
7     /etc/init.d/gitorious-unicorn reload
8 }
9
10 restart_resque_worker() {
11     status_message "Resque"
12     /sbin/initctl stop resque-worker >/dev/null 2>/dev/null
13     /sbin/initctl start resque-worker >/dev/null 2>/dev/null
14 }
15
16 restart_git_daemons() {
17     if [ -f /etc/monit.d/git-daemons.monit ]; then
18         status_message "Git-daemons"
19         /usr/bin/monit restart git-daemons
20     fi
21     if [ -f /etc/monit.d/git-proxy.monit ]; then
22         status_message "Git-proxy"
23         /usr/bin/monit restart git-proxy
24     fi
25 }
26
27 restart_nginx() {
28     status_message "Nginx"
29     /etc/init.d/nginx restart >/dev/null 2>&1
30 }
31
32 restart_sphinx() {
33     status_message "Sphinx"
34     /usr/bin/monit restart thinking-sphinx
35 }
36
37
38 reload_unicorn
39 restart_resque_worker
40 restart_git_daemons
41 restart_nginx
42 restart_sphinx