#1. at
# ntp ์๋ฒ ์ค์ง
systemctl stop ntpd
systemctl stop chronyd
yum -y install at
# at ์คํ
/usr/sbin/atd
# at ์คํ 2
systemctl restart atd
# at ์๋น์ค ํ์ธ
ps -ef | at
# ์์ฝ์์
ํ์ธ
at -l
# ์์ฝ์์
ํ์ธ 2
atq
# ์๊ฐ ๋ณ๊ฒฝ
date -s '2021-05-16 14:10'
# at HH:mm MMddyyyy
at 14:11 05162021
#> touch /tmp/at
#> [ Ctrl + D ] ๋ก ๋น ์ ธ๋๊ฐ ์ ์๋ค.
# job ํ์ธ
at -l
# job ์ญ์
at -d [job ๋ฒํธ]
watch -n 1 ls -ld /tmp/at
echo "touch /tmp/at" | at 14:11 05162021
vim tmp.sh
###############################
#!/bin/bash
touch /tmp/at
###############################
# ์์ฝ๋ ์๊ฐ์ ์ ํ์ผ ์คํ
at 14:11 05162021 -f tmp.sh
# ์์ฝ๋ ์๊ฐ์ ์ ํ์ผ ์คํ 2
at 14:11 05162021 < tmp.sh
#2. cron
# crontab package ์ค์น
yum -y install cronie
# cron ์คํ 1
/usr/sbin/crond
# cron ์คํ 2
systemctl start crond
# ์์ฝ ์์
ํ์ธ
crontab -l
# 2. 1๋ฒ์์ ์์ฑํ ํ๋ก๊ทธ๋จ์ ์ด์ฉํ์ฌ ๋งค ๋ถ๋ง๋ค /tmpํด๋์ ์๋
# ํ์ผ์ ์๋์ผ๋ก ์ ๋ฆฌํ๋๋ก ํ์์ค.
# ์์ฝ ์์
์ถ๊ฐ
# *ใใใใใใ*ใใใใใใ*ใใใใใใ*ใใใใใใ*
# ๋ถ(0-59)ใใ์๊ฐ(0-23)ใใ์ผ(1-31)ใใ์(1-12)ใใใ์์ผ(0-7) ์ - ์ผ
==================================================
crontab -e
==================================================
* * * * * /app/script/shell/fileArrange.sh /tmp
==================================================
# ๋งค์ฃผ ๊ธ์์ผ ์ค์ 5์ 45๋ถ์ fileArrange.sh ๋ฅผ ์คํ
45 5 * * 5 /app/script/shell/fileArrange.sh /tmp
# ๋งค์ผ ๋งค์๊ฐ 0๋ถ, 20๋ถ, 40๋ถ์ fileArrange.sh ๋ฅผ ์คํ
0,20,40 * * * * /app/script/shell/fileArrange.sh /tmp
# ๋งค์ผ 1์ 0๋ถ๋ถํฐ 30๋ถ๊น์ง ๋งค๋ถ fileArrange.sh ๋ฅผ ์คํ
0-30 1 * * * /app/script/shell/fileArrange.sh /tmp
# ๋งค 10๋ถ๋ง๋ค fileArrange.sh ๋ฅผ ์คํ
*/10 * * * * /app/script/shell/fileArrange.sh /tmp
# 5์ผ์์ 6์ผ๊น์ง 2์,3์,4์์ ๋งค 10๋ถ๋ง๋ค fileArrange.sh
๋ฅผ ์คํ
*/10 2,3,4 5-6 * * /app/script/shell/fileArrange.sh /tmp
# ํฌ๋ก ํญ ๋ฐฑ์
crontab -l > /tmp/cron_config.bak
CRON
mkdir -p /app/script/shell/
--1๋ฒ ํ์ผ--
# 1. ์คํ ํ๋ก๊ทธ๋จ์ ์ ์ธํ ๋ชจ๋ ํ์ผ์ ์์ฑํ ๋ ์ง์ ๋ง๋
# ํด๋๋ก ์ด๋ํ๋ ํ๋ก๊ทธ๋จ์ ์์ฑํ์์ค.
# ํ๋ผ๋ฉํฐ๋ก ์์
ํ ํด๋๋ฅผ ์ง์ ํ ์ ์๋๋ก ํ์์ค. (์์ ๊ฒฝ์ฐ ํ์ฌ ํด๋ ์์
)
:<<'END'
==================================================
fileArrange.sh
==================================================
#!/bin/bash
param1=$1
if [ -d $1 ] && [ -n "$1" ]
then
parent=$(dirname "${param1}")
if [ "$parent" == "/" ]
then
unset parent
fi
param1=${parent}/$(basename "${param1}")/
else
param1='./'
fi
ls -l $param1 --time-style="+%Y%m%d" | grep -v total | awk '{print $6 " " $7}' | while read result
do
date=`echo $result | awk '{print $1}'`
fname=`echo $result | awk '{print $2}'`
if [ "${0##*/}" == "${fname}" ]
then
continue
fi
if [ -d $param1$fname ]
then
continue
fi
if [ ! -d $date ]
then
mkdir -p $param1$date
fi
mv $param1$fname $param1$date/
done
':: Linux ๐ฉ > Linux_basic' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[๋ฆฌ๋ ์ค] [Raid 1] (0) | 2021.05.19 |
---|---|
[๋ฆฌ๋ ์ค] [Raid 0] (0) | 2021.05.19 |
[๋ฆฌ๋ ์ค1] 5์ผ์ฐจ [grep, -E ์ต์ , ์ต์ ๋ค] (0) | 2021.04.27 |
[๋ฆฌ๋ ์ค1] 5์ผ์ฐจ ์ฐธ๊ณ ํ์ผ (0) | 2021.04.26 |
[๋ฆฌ๋ ์ค1] 4์ผ์ฐจ ์ฐธ๊ณ ํ์ผ (0) | 2021.04.26 |
๋๊ธ