source: llxcfg/trunk/fuentes/debian/llxcfg-service-cli.sample @ 98

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

adding proyect files

  • Property svn:executable set to *
File size: 1.9 KB
Line 
1#!/bin/bash
2# -------
3# File:        llxcfg-[SERVICE] # replace with service name #
4# Description: LliureX [SERVICE] command line utility
5# Author:      #put your name/email here#
6#
7# This program is free software; you can redistribute it and/or modify
8# it under the terms of the GNU General Public License as published by
9# the Free Software Foundation; either version 2 of the License, or
10# (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15# GNU General Public License for more details.
16#
17# You should have received a copy of the GNU General Public License along
18# with this program; if not, write to the Free Software Foundation, Inc.,
19# 51 Franklin St, Fifth Floor, Boston MA 02110-1301 USA
20# --------
21
22set -e
23
24# variables
25# ---------
26
27# fill this variable with related cpkg list (space delimited)
28CPKGS=""
29
30# functions
31# ---------
32
33usage(){
34   CMD="$(basename "$0")"
35   exit_message \
36"Usage: $CMD {start|stop|restart|reload|allow|deny|info|listfiles|update|revert|cpkgs}\n\
37       $CMD grepinfo FIELD\n\
38       # add specific options here #\n\
39       options: -u|--update"
40}
41
42exit_message() {
43   echo -e "$1" >&2
44   exit 1
45}
46
47# main
48# ---------
49
50case "$1" in
51   -u|--update)
52      AUTOUPDATE="Y"
53      shift
54      ;;
55esac
56ACTION="$1"
57rc=0
58
59case "$ACTION" in
60   start|stop|restart|reload)
61      llxcfg-cpkg invoke "$ACTION" $CPKGS || rc=$?
62      exit $rc
63      ;;
64   cpkgs)
65      for c in $CPKGS ; do
66         echo $c
67      done
68      exit 0
69      ;;
70   allow|deny|listfiles|update|revert|info)
71      llxcfg-cpkg "$ACTION" $CPKGS || rc=$?
72      exit $rc
73      ;;
74   grepinfo)
75      [ "$2" ] || usage
76      llxcfg-cpkg grepinfo "$2" $CPKGS || rc=$?
77      exit $rc
78      ;;
79# add specific options here
80   *)
81      usage
82      ;;
83esac
84
85[ -z "$AUTOUPDATE" ] || llxcfg-cpkg update $CPKGS || rc=$?
86exit $rc
Note: See TracBrowser for help on using the repository browser.