You are on page 1of 9

3

crontab
at

nohup

cron

At at

&
Nohup

3.1 croncrontab

c r o n
c r o n t a b c r o n t a b
s h e l l
c r o n t a b

cron.denycron.allow crontab

3.1.1 crontab

c r o n t a b

1 159
2 1230
3 131
4 112
5 060
6

3 23
crontab
<><><><><>
<>
C r o n t a b

-
1 - 5,
1 , 4 *
* 5
#

3.1.2 crontab

crontab
30 21* * * /apps/bin/cleanup.sh
21:30/apps/bincleanup.sh
45 4 1,10,22 * * /apps/bin/backup.sh
110224:45/apps/binbackup.sh
10 1 * * 6,0 /bin/find -name "core" -exec rm {} \;
1:10find
0,30 18-23 * * * /apps/bin/dbcheck.sh
18:0023:0030/apps/bindbcheck.sh
0 23 * * 6 /apps/bin/qtrend.sh
11:00pm/apps/binqtrend.sh
c r o n t a bs h e l l
c r o n
cron cron
s h e l l

cron

3.1.3 crontab

crontab
Crontab [-u user] -e -l -r

-u
-e crontab
-l crontab
-r crontab
- u c r o n t a b
24 shell

3.1.4 crontab

c r o n c r o n t a b
E D I TO Rc r o n c r o n t a b 9 9 %U N I XL I N U X
v i $ H O M E . p r o f i l e

EDITOR=vi; export EDITOR



< u s e r > c r o n < u s e r > d a v e c r o n

5
1 5
tty1

crontab cron
$ crontab davecron

cron 15
/var/spool/cron
dave

3.1.5 crontab

crontab

$ H O M E c r o n t a b

$ crontab -l > $HOME/mycron

crontab

3.1.6 crontab

crontab EDITOR vi
vicrontab
$ crontab -e

v i c r o n t a b

3 25
c r o n

crontab

c r o n t a b

crontab -l

3.1.7 crontab

crontab
$ crontab -r

3.1.8 crontab

c r o n t a b $ H O M E
/var/spool/cron/<username><username>

$ crontab <filename>
<filename>$HOME
$ H O M E
crontab re
crontab
c r o n t a b c r o n t a b
crontab delete
<Ctrl-D> crontab

3.2 at

a t c r o n
10min
crontab
a t c r o n t a b

c r o n t a b / e t c a t . a l l o wa t . d e n y
26 shell

at at crontab

at
at [-f script] [-m -l -r] [time] [date]


-f script
-l atq
-r I D U N I X
atrm
-m
time at HH H . H H M MH H : M MH : MHM
a.m.p.m.
date at todaytomorrow

3.2.1 at

at at
at shell

at / at
<CTRL-D>

< E O T >< C T R L - D >2 1 : 1 0 f i n d


job 1

/at

3 27

at shell -f

db_table.sh 3:00
echoat
$ echo find /etc -name "passwd" -print | at now +1 minute

3.2.2

at -l

/ aa t
a t q a t
/var/spool/at

3.2.3


a t r m [ j o b n o ]a t - r [ j o b n o ]

at -l
at -r

at-r [job no]

3.3 &


28 shell

&

&


find shell

command >out.file 2>&1 &

out.file

3.3.1

f i n d s r m . c o n f
find.dt

27015

p s 1

3.3.2 ps


ps1 psgrep

ps x

ps

3.3.3

k i l l s h e l l

3 29
kill
kill -signal [process_number]


( )


kill


nohup

3.4 nohup


nohup Nohup (no
hang up)

nohup command &

3.4.1 nohup

n o h u p
nohup.out
nohup command > myout.file 2>&1
myout.file

ps1

shell

ps x ps -ef|grep ps1

3.4.2

s h e l l n o h u p

30 shell


$ chmod 744 quarterend

qtr.out

3.5


C r o n