Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env bash
- check_root() {
- [ "$EUID" -ne 0 ] && echo "Por favor, execute como root."; exit 1
- }
- # Configura o serviço do Calibre-Web
- configure_calibre_web_service() {
- local calibre_web_path="$1"
- local virtualenv_path="$2"
- local service_file="$3"
- cat << EOF > "$service_file"
- [Unit]
- Description=Calibre-Web Service
- After=network.target
- [Service]
- User=root
- WorkingDirectory=$calibre_web_path
- ExecStart=$virtualenv_path/bin/python $calibre_web_path/cps
- [Install]
- WantedBy=multi-user.target
- EOF
- enable_start_service "$service_file"
- }
- # Habilita e inicia o serviço
- enable_start_service() {
- local service_file="$1"
- systemctl enable calibre-web
- systemctl start calibre-web
- echo "Serviço do Calibre-Web configurado para iniciar automaticamente."
- }
- main() {
- check_root
- local calibre_path="/root/calibre-web"
- local virtualenv_path="/root/calibre-web/venv"
- local service_file="/etc/systemd/system/calibre-web.service"
- configure_calibre_web_service "$calibre_path" "$virtualenv_path" "$service_file"
- }
- main
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement