ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/lmainit/standard.fac
Revision: 1.3
Committed: Mon Mar 8 22:58:16 2004 UTC (20 years, 3 months ago) by root
Branch: MAIN
CVS Tags: HEAD
Changes since 1.2: +5 -1 lines
Log Message:
*** empty log message ***

File Contents

# User Rev Content
1 root 1.1 #!/ vim, this is /bash syntax !/
2    
3     #def "cslip" "static cslip connection on \$1 from \$2 to \$3"
4     # start() {
5     # my($line,$source,$dest,$speed)=@_
6     # my($pid,$ifname)=SYS::Slip::launch("SLIP-$dest",$line,$speed?$speed:&SYS::Slip::B115200,1,$source,$dest)
7     # echo "added static slip connection $ifname, pid $pid"
8     # }
9     # stop() {
10     # my($line,$source,$dest,$speed)=@_
11     # killall "TERM" "SLIP-$dest"
12     # }
13     #enddef
14    
15     def netdev "network device \$1 ip \$2"
16     start() {
17     local dev="$1"
18     local ip="$2"
19     local net="$3"
20     local netmask="$4"
21 root 1.3 if [ $# -gt 4 ]; then
22     safe_eval /sbin/ifconfig "$dev" inet "$ip" netmask "$netmask" broadcast "$5"
23     else
24     safe_eval /sbin/ifconfig "$dev" inet "$ip" netmask "$netmask"
25     fi
26 root 1.1 }
27     stop() {
28     local dev="$1"
29     /sbin/ifconfig $dev down
30     }
31     end
32    
33     def default_gateway "default gateway \$1"
34     start() {
35     safe_eval /sbin/route add default gw "$1"
36     }
37     stop() {
38     /sbin/route del default
39     }
40     end
41    
42     def module "load module \$1"
43     start() {
44     echo "loading module $1"
45     safe_eval /sbin/modprobe "$1"
46     }
47     stop() {
48     echo "removing module $1"
49     safe_eval /sbin/modprobe -r "$1"
50     }
51     end
52    
53     defalias syslogd "system logging daemon" "simpledaemon::syslogd -r -s laendle:/var/run/syslogd.pid"
54     defalias klogd "kernel logging daemon" "simpledaemon::klogd -s:/var/run/klogd.pid"
55     defalias inetd "network server daemon" "simpledaemon::inetd:/var/run/inetd.pid"
56 root 1.2 defalias portmap "Sun-RPC portmapper" "simpledaemon::portmap"
57 root 1.1 defalias rpc_portmap "Sun-RPC portmapper" "simpledaemon::rpc.portmap"
58     defalias rpc_mountd "Sun RPC-Mount daemon" "simpledaemon::rpc.mountd"
59     defalias rpc_nfsd "Sun RPC-NFS daemon" "simpledaemon::rpc.nfsd"
60     defalias rpc_lockd "Sun RPC-NFS locking daemon" "simpledaemon::rpc.lockd"
61     defalias rpc_statd "Sun RPC-NFS status daemon" "simpledaemon::rpc.statd"
62     defalias pcnfsd "PC-NFS daemon" "simpledaemon::rpc.pcnfsd"
63     defalias bwnfsd "BW-NFS daemon" "simpledaemon::rpc.bwnfsd"
64     defalias named "DNS name server daemon" "simpledaemon::named"
65     defalias routed "Dynamic route daemon" "simpledaemon::routed"
66     defalias rwhod "remote who daemon" "simpledaemon::rwhod"
67     defalias lpd "BSD echo spooler daemon" "simpledaemon::lpd"
68     defalias ypbind "NIS server binder" "simpledaemon::ypbind"
69     defalias crond "CRON daemon" "simpledaemon::daemonize crond >>/var/log/cron.log 2>&1:/var/run/crond.pid"
70     defalias kerneld "Kernel-daemon" "simpledaemon::kerneld"
71     defalias xfs "X fontserver" "simpledaemon::daemonize xfs"
72     defalias xfstt "X truetype fontserver" "simpledaemon::daemonize xfsft"
73     defalias nscd "NameServer Caching Daemon" "simpledaemon::nscd:/var/run/nscd.pid"
74     defalias wwwoffled "WWW Offle Daemon" "simpledaemon::wwwoffled"
75     defalias lircd "lircd" "simpledaemon::lircd:/var/lock/LCK..lirc"
76     defalias postgresql "PostgreSQL" "simpledaemon::daemonize su - pg -c '/home/pg/bin/postmaster -o -F -i -D /home/pg/data -S'"
77    
78     def "randomdevice" "random number generator"
79     start() {
80     if [ -r /etc/random-seed ]; then
81     dd if=/etc/random-seed of=/dev/urandom bs=512 count=1 &>/dev/null
82     rm -f /etc/random-seed
83     fi
84     dd if=/dev/urandom of=/dev/null bs=512 count=1 &>/dev/null
85     }
86     stop() {
87     (
88     umask 077;
89     dd if=/dev/urandom of=/etc/random-seed bs=512 count=1 &>/dev/null
90     )
91     }
92     end
93    
94     def "hostname" "set hostname and domainname"
95     start() {
96     echo "hostname is $HOSTNAME"
97     safe_eval /bin/hostname "$HOSTNAME"
98     if [ -n "$YP_DOMAIN" ]; then
99     echo "yp-domain is $YP_DOMAIN"
100     safe_eval ypdomainname "$YP_DOMAIN"
101     fi
102     }
103     end
104    
105     # the next facility is of limited use for most people
106     # that do not have my fw.sh script
107     def "fw" "static firewalling rules"
108     start() {
109     test -e /etc/firewall.m4 && fw.sh /etc/firewall.m4 | sh
110     }
111     end
112    
113     def "write_utmp" "write utmp-entry"
114     start() {
115     echo "Writing utmp entry....."
116     /sbin/halt -w
117     sync
118     }
119     end
120    
121     def "umount_fs" "unmount filesystems"
122     start() {
123     sync
124     echo "Unmounting file systems....."
125     safe_eval /bin/umount -var
126     sync
127     }
128     stop() {
129     echo "Mounting file systems....."
130     safe_eval /bin/mount -va
131     }
132     end
133    
134     def "umount_root" "unmount root-fs"
135     start() {
136     echo "Remount root file system read-only....."
137     sync
138     safe_eval /bin/umount -nvr /
139     sync
140     sync
141     sync
142     echo "Done..... just a second..."
143     sync
144     sync
145     sync
146     }
147     stop() {
148     echo "Remount root file system read-write....."
149     safe_eval /bin/mount -vnoremount,rw /
150     }
151     end
152    
153     #def "lowpri" "low priority system services"
154     # start() {
155     # run_daemon($rcpath."/lowpri")
156     # }
157     # stop() {
158     # kill_pidfile("HUP",undef,"/var/run/lowpri.pid")
159     # }
160     #enddef
161    
162     def "system_stop" "System \$1"
163     start() {
164     local type="$1"
165     sync
166     if [ "$type" == "halt" ]; then
167     echo "System halting....."
168     /sbin/halt -n -f -p
169     fi
170     if [ "$type" == "reboot" ]; then
171     echo "System reboot....."
172     /sbin/reboot -n -f
173     fi
174     }
175     end
176    
177     #def "runqueue" "Runs runq locally [and on remote machine \$1]"
178     # start() {
179     # my($remote)=@_
180     # if($remote) {
181     # unless(system("/usr/bin/fping" "-q" "-r" "0" "-t" "400",$remote)>>8) {
182     # system("/usr/sbin/runq -d1 -R $remote")
183     # system("/usr/app/bin/fetchmail" "-v" "-p" "ETRN" "-S" "#@",$remote)
184     # } else {
185     # echo "remote system $remote unreachable, skipping delivery"
186     # }
187     # }
188     # }
189     #enddef
190    
191     def "hdparm" "HDPARM: \$1"
192     start() {
193     local path="$1"
194     local settings="$2"
195     safe_eval hdparm "$settings"
196     }
197     end
198    
199     def "sysctl" "Sysctl setting \$1"
200     start() {
201     if (($#>0)); then
202     local path="$1"; shift
203     sysctl -w "$path=$@"
204     else
205     safe_eval sysctl -p
206     fi
207     }
208     end
209    
210     def sh "\$*"
211     start() {
212     eval safe_eval "$@"
213     }
214     stop() {
215     eval safe_eval "$@"
216     }
217     end
218    
219