Revision 1909,
1.3 KB
checked in by probe, 35 years ago
(diff) |
Now creates log-file, accounting-file, and .options file if they do
not already exist
|
Line | |
---|
1 | #!/bin/csh -f |
---|
2 | |
---|
3 | # |
---|
4 | # script for creating spooling directories |
---|
5 | # |
---|
6 | |
---|
7 | if ($?DEBUG) set verbose |
---|
8 | |
---|
9 | set destdir="" |
---|
10 | set prot=775 |
---|
11 | set owner=daemon |
---|
12 | set group=daemon |
---|
13 | |
---|
14 | if ($1 != "") set destdir = $1 |
---|
15 | if ($2 != "") set prot = $2 |
---|
16 | if ($3 != "") set owner = $3 |
---|
17 | if ($4 != "") set group = $4 |
---|
18 | |
---|
19 | echo "# $0 $destdir $prot $owner $group" |
---|
20 | |
---|
21 | set f=/etc/printcap |
---|
22 | set dirs=(`sed -n -e '/^#/d' -e '/:sd=/s/^.*:sd=\([^:]*\).*$/\1/p' $f`) |
---|
23 | set logs=(`sed -n -e '/^#/d' -e '/:lf=/s/^.*:lf=\([^:]*\).*$/\1/p' $f`) |
---|
24 | set acct=(`sed -n -e '/^#/d' -e '/:af=/s/^.*:af=\([^:]*\).*$/\1/p' $f`) |
---|
25 | |
---|
26 | foreach j (${dirs}) |
---|
27 | set i = "${destdir}/${j}" |
---|
28 | set sdd = ${i:h} |
---|
29 | if (! -d $sdd) then |
---|
30 | echo "# Creating enclosing directory $sdd" |
---|
31 | mkdir $sdd |
---|
32 | chown $owner $sdd |
---|
33 | chgrp $group $sdd |
---|
34 | chmod $prot $sdd |
---|
35 | echo "# `ls -ldg $sdd`" |
---|
36 | endif |
---|
37 | if (! -d $i) then |
---|
38 | echo "# Creating $i" |
---|
39 | mkdir $i |
---|
40 | chown $owner $i |
---|
41 | chgrp $group $i |
---|
42 | chmod $prot $i |
---|
43 | echo "# `ls -lgd $i`" |
---|
44 | endif |
---|
45 | if (! -f $i/.options) then |
---|
46 | echo "# Creating $i/.options" |
---|
47 | cat > $i/.options << EOF |
---|
48 | BANNERFIRST=1 |
---|
49 | BANNERLAST=0 |
---|
50 | REVERSE="" |
---|
51 | EOF |
---|
52 | chown $owner $i/.options |
---|
53 | chgrp $group $i/.options |
---|
54 | chmod $prot $i/.options |
---|
55 | endif |
---|
56 | end |
---|
57 | |
---|
58 | foreach j (${logs} ${acct}) |
---|
59 | set i = "${destdir}/${j}" |
---|
60 | if (! -f $i) then |
---|
61 | echo "# Creating $i" |
---|
62 | cp /dev/null $i |
---|
63 | chown $owner $i |
---|
64 | chgrp $group $i |
---|
65 | chmod $prot $i |
---|
66 | endif |
---|
67 | end |
---|
Note: See
TracBrowser
for help on using the repository browser.