A free Basic UNIX-training with muLinux
Notes: This Text is roughly translated (German to English) by a translating program. Sorry, but I have not time for the translation. Maybe you can do this.
Automatic Execution of Programs
In order to be able to start programs for certain times, a program running in
the background is necessary. This constantly compares the time with the time
entries in the function list. If a time entry in the table corresponds the
current time, then the appropriate program is started. So routine functions in
the night hours can be completed independently by the computer. Such functions
would be z. B.
- Data protections
- Clearing up work in the directory system
- Statistics analyses of Internet accesses
- Status reports by email or SMS
- Fax dispatch
- Downloads
Daemons
One calls programs, which operate in the background, daemons.
They wait to a request to it come and enter into force or are then
entered into force. Most Daemons is already started with boats. Other Daemons is
started only if necessary by a Oberdaemon.
For the time-controlled processing of programs is the daemons atd and crond responsible.
One detects daemons to d> end.
In order to activate this Daemons under muLinux, we these must also setup start.
/# setup -f server
Do you want to change server/daemons setup? (y/n): y
Do you want to start XWindow server at any boot? (y/n): [Enter]
Do you want start atd daemon running? (y/n): y
Do you want start RING server running? (y/n): [Enter]
Do you want start SERIAL server running? (y/n): [Enter]
Do you want start DIALIN_SERVER running? (y/n): [Enter]
Do you want start FAX_SERVER running? (y/n): [Enter]
Do you want start TELNET_SERVER running? (y/n): [Enter]
Do you want start INETD_SERVER running? (y/n): [Enter]
Do you want start VCM_SERVER running? (y/n): [Enter]
/# setup -f crond
Do you want a running cron daemon? (y/n): y
Do you want to edit /etc/crontab now: n
We save our configuration.
/# setup -s tutorial01
Unique Execution of Processes with at at a Certain Time
With at the system can be arranged to execute any commands or
Shellskripte at a beforehand determined point in time. The programs are started
at a beforehand determined point in time by the system in the background. After
its execution the job is deleted. An assistance becomes with the option - h displayed.
/# at -h
The syntax of the muLinux version of the at deviates instruction from the normal version.
Here is at to use as filters.
A tone is to ring out on 5. of the month at 04:00 am o'clock.
/# echo ´wave -c 440´ | at 05 04:00
The computer is to be shutdown on 5. of the monthly at 05:00 pm.
/# echo ´halt´ | at 05 17:00
Each job receives a job number.
The queue of the jobs leaves itself also atq display.
/# atq
In the directory /var/spool/atspool text files for the jobs are stored.
/# ls /var/spool/atspool
The name of the file corresponds to the pertinent job number.
With less contents can be displayed.
/# cd /var/spool/atspool
/# less job number
Jobs can be deleted also before the execution.
/# atrm jobnumber
Note:
Also under Windows NT there is that in the DOS window at command in similar form.
One could in such a way install on a NT computer the small muLinux.
At the night then muLinux raising can leave automatically, in order to execute certain internal messages.
By timing can then muLinux the computer again with NT start.
So a whole operation system can function as a Trojan Horse.
Regular Execution of Processes with /etc/crontab
The file /etc/crontab the regular execution of programs controls.
In the correct Unix each user has one crontab file.
There is also further instruction for the control of crond available.
With muLinux we must the file /etc/crontab edit.
/# vi /etc/crontab
Here their contents:
# /etc/crontab: system-wide crontab
# Unlike any other crontab you don't have to run the `crontab'
# command to install the new version when you edit this file.
# This file also has a username field, that none of the other crontabs do.
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
# m h dom mon dow user command
42 6 * * * root run-parts /etc/cron.daily
47 6 * * 7 root run-parts /etc/cron.weekly
52 6 1 * * root run-parts /etc/cron.monthly
# test vari
#*/3 * * * * root wave -c 220 4
#*/15 * * * * root (wave -c 440 1; wave -c 880 3)
#*/2 * * * * root echo "ciao" > /dev/console
#* */2 * * * root mail -s "Da cron" root%Ciao, amico%
Comments begin also #.
Each job is represented by a line.
Whereby the following sequence to consider is (see comment line):
- min = minute (number from 0 to 59)
- h = hour (number from 0 to 23)
- dom (day of the month) = day (number from 1 to 31)
- month = month (number from 1 to 12)
- dow (day of the week) = weekday (number of 0 = Sunday to 6=Sonnabend)
- user = user
- command = comand which can be required
An asterisk " * " is with all parameters for all possible in each case values.
In the first section the muLinux instruction becomes run parts called.
This causes an executing of all programs in the indicated directories. In the
above example thus all programs in the directory become at 6:42 o'clock each day
/etc/cron.daily executed.
Around 06:47 become at each 7. Day of the week (Sunday) all programs in the directory /etc/cron.weekly called.
On the first day each monthly around 06:52 all programs become in /etc/cron.monthly started.
In the directory /etc/cron.daily is the example script Test .
It has the following contents:
#!/bin/sh
#wave -c 440 1
#wave -c 880 3
It does not make nothing at all, since all lines are out-commentated.
We can remove the comment in a line.
So e.g. for wave - c 440 1.
It sounded thus to each morning beep.
That is perhaps no good idea.
We want to use the computer as bells.
At each working-day it is to produce around 6:55 a tone.
#m h dom mon dow user command
55 6 * * 1-5 root wave -c 220 4
Robert.Warnke@giso.de (copyleft) Robert Warnke, Berlin (Germany) - You can write me in English. | http://rowa.giso.de
|