File: collection.sh

package info (click to toggle)
remstats 1.0.13a-6.3
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 6,884 kB
  • ctags: 1,282
  • sloc: perl: 16,135; ansic: 2,776; sh: 1,056; makefile: 687
file content (59 lines) | stat: -rw-r--r-- 1,123 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/bin/sh

# collection - stop/start collection
# $Id: collection.sh,v 1.4 2002/05/28 15:54:50 remstats Exp $
# from remstats @@VERSION@@

# Copyright 1999, 2000, 2001, 2002 (c) Thomas Erskine <@@AUTHOR@@>
# See the COPYRIGHT file with the distribution.

# - - -   Version History - - -
# $Revision: 1.4 $

# - - -   Setup   - - -

if [ $# != 1 ] ; then
	echo >&2 "usage: `basename $0` {stop MSG|start|status}"
	exit 0
fi

what="$1"
file="@@TMPDIR@@/STOP-run-remstats"

# - - -   Mainline   - - -

case "$what" in 
	start)
		if [ -f $file ] ; then
			rm -f $file
			echo "stop-file removed ($file)"
		else
			echo "no stop-file; it's not stopped"
		fi
		;;
	stop)
		if [ -f $file ] ; then
			echo "stop-file exists ($file); it's stopped already"
		else
			echo >$file "`date +%Y-%m-%d %H:%M:%S`"
			if [ ! -z "$2" ] ; then
				echo >>$file "Reason: $2"
			else
				echo >>$file "Reason: unknown"
			fi
		fi
		;;
	status)
		if [ -f $file ] ; then
			echo "REMSTATS STOPPED"
			cat $file
		else
			echo "remstats collection not stopped"
		fi
		;;
	*)
		echo >&2 "usage: `basename $0` {stop|start|status}"
		exit 0
		;;
esac