Upgrade yt-dlp to version 2022.11.11
[sunny256-utils.git] / afvctl
blobf00c6ce6101e2e312ae255acdc32901575244b3d
1 #!/bin/sh
3 # afvctl
4 # File ID: 0bd0b80a-5d37-11df-a6ed-90e6ba3022ac
5 # Starter/stopper/viser status for alle afv’er
6 # FIXME: Dette skulle egentlig vært integrert i afv(1).
8 afvdir=$AFVROOT$(/bin/pwd)
9 currstop=$afvdir/stop
10 dontstop=$afvdir/protected
11 retval=0
13 case "$1" in
14 start)
15 echo -n Starter afv …
16 rm -f $currstop
17 retval=$?
19 stop)
20 echo -n Stopper afv …
21 touch $currstop
22 sleep 5
23 rm $currstop
24 retval=$?
26 startall)
27 echo -n Starter alle afv’er …
28 rm -f $AFVROOT/stop
29 retval=$?
31 stopall)
32 echo -n Stopper alle afv’er …
33 touch $AFVROOT/stop
34 sleep 5
35 rm $AFVROOT/stop
36 retval=$?
38 stat*)
39 ps auxw | grep afv | grep -v -e 'afvctl stat' -e 'grep afv' -e 'grep -v -e '
40 retval=$?
41 exit $retval;
43 protect*)
44 [ -d $afvdir ] || mkdir -p $afvdir || { echo "$0: mkdir $afvdir: Gikk visst dårlig."; }
45 touch $dontstop || [ -e $dontstop ] || { echo "$0: $dontstop: Fila ble visst ikke opprettet. Hm. Muskelmanko?." >&2; retval=1; }
46 echo Katalogen `/bin/pwd` er nå beskyttet mot «afvctl stop*»...
48 unprotect*)
49 if [ -e $dontstop ]; then
50 rm $dontstop || { echo "$0: $dontstop: Klarte ikke å slette fila, katalogen er fortsatt beskyttet." >&2; exit 1; }
51 echo Fjernet stoppbeskyttelsen.
52 else
53 echo Katalogen er jo egentlig ikke beskyttet, da...
54 exit 0;
58 echo
59 echo Syntax: $0 start\|stop\|stat\|protect\|unprotect
60 echo
61 exit 1
63 esac
65 if [ "$retval" = "0" ]; then
66 echo OK
67 else
68 echo FEIL \($retval\)
71 exit $retval