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