first commit

Adding scripts Primitives "install" " delete" "upgrade" and nginx conf
This commit is contained in:
Jeremy MANSON
2016-03-07 10:19:14 +01:00
parent c8ece66482
commit 93a05133b0
6 changed files with 111 additions and 0 deletions

45
scripts/install Normal file
View File

@ -0,0 +1,45 @@
#!/bin/bash
# Retrieve arguments
domain=$1
path=$2
sudo yunohost app checkurl $domain$path -a shinken
if [[ ! $? -eq 0 ]]; then
exit 1
fi
# Create user
id -u shinken &>/dev/null || sudo useradd -d /home/yunohost.app/shinken shinken
# Install required packages
sudo apt-get install -y apt-get install python-cherrypy3 python-pip python-pycurl nagios-plugins
sudo bash -c "pip install shinken"
# prepare shinken
sudo pip install pymongo>=3.0.3 requests arrow bottle==0.12.8 passlib
sudo apt-get install mongodb
sudo su -c shinken --int -l shinken
sudo su -c shinken install webui2 -l shinken
# Remove trailing "/" for next commands
path=${path%/}
# Monitor service
sudo yunohost service add shinken
# Configure Nginx
sudo sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/shinken.conf
# Add new shinken service
sudo update-rc.d shinken defaults
# Generate SSOwat conf
sudo service nginx restart
echo $?
sudo yunohost app ssowatconf
sudo service shinken start

11
scripts/remove Normal file
View File

@ -0,0 +1,11 @@
#!/bin/bash
domain=$(sudo yunohost app setting shinken domain)
sudo rm /etc/nginx/conf.d/$domain.d/shinken.conf
sudo rm -rf /home/yunohost.app/shinken
sudo sudo update-rc.d -f shinken remove
sudo service nginx reload
sudo yunohost app ssowatconf

14
scripts/upgrade Normal file
View File

@ -0,0 +1,14 @@
#!/bin/bash
# Retrieve arguments
domain=$(sudo yunohost app setting shinken domain)
path=$(sudo yunohost app setting shinken path)
# Remove trailing "/" for next commands
path=${path%/}
# Configure Nginx and reload
sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/shinken.conf
sudo service nginx reload