source: lliurex-disable-upstart-services/trunk/fuentes/install/usr/sbin/upstart-manager @ 854

Last change on this file since 854 was 854, checked in by hectorgh, 5 years ago

adding project files

  • Property svn:executable set to *
File size: 691 bytes
Line 
1#!/bin/bash
2
3usage(){
4echo -e "\nUsage"
5echo -e "\t$0 enable|disable service..."
6echo -e "\t$0 list [enable|disable] "
7echo ""
8exit 1
9}
10
11
12[ $# -ge 1 ] || usage
13
14OP="$1"
15shift
16case $OP in
17
18enable|disable)
19        [ $UID -eq 0 ] || { echo "You are't root" ; exit 1 ;}
20        [ $# -ge 1 ] || usage
21        if [ "$OP" = "disable" ]; then
22                for x in $@; do
23                        echo "manual" > /etc/init/${x}.override
24                done   
25        else
26                for x in $@; do
27                        rm /etc/init/${x}.override 2> /dev/null || true
28                done   
29
30        fi
31;;
32list)
33        EXTENSION=""
34        if [ "$1" = "enable" ]; then
35                EXTENSION=".conf"
36        elif [ "$1" = "disable" ]; then
37                EXTENSION=".override"
38        fi
39        for x in $(ls /etc/init/*$EXTENSION); do
40                echo $(basename ${x%.*})
41        done
42       
43;;
44esac
Note: See TracBrowser for help on using the repository browser.