source: trunk/athena/bin/lpr/makespools @ 1909

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
7if ($?DEBUG) set verbose
8
9set destdir=""
10set prot=775
11set owner=daemon
12set group=daemon
13
14if ($1 != "") set destdir = $1
15if ($2 != "") set prot = $2
16if ($3 != "") set owner = $3
17if ($4 != "") set group = $4
18
19echo "# $0  $destdir  $prot  $owner  $group"
20
21set f=/etc/printcap
22set dirs=(`sed -n -e '/^#/d' -e '/:sd=/s/^.*:sd=\([^:]*\).*$/\1/p' $f`)
23set logs=(`sed -n -e '/^#/d' -e '/:lf=/s/^.*:lf=\([^:]*\).*$/\1/p' $f`)
24set acct=(`sed -n -e '/^#/d' -e '/:af=/s/^.*:af=\([^:]*\).*$/\1/p' $f`)
25
26foreach 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
48BANNERFIRST=1
49BANNERLAST=0
50REVERSE=""
51EOF
52                chown $owner $i/.options
53                chgrp $group $i/.options
54                chmod $prot $i/.options
55                endif
56        end
57
58foreach 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.