=================================================
$ nano backup
#!/bin/bash
if ! [ -d bak ]; then
mkdir bak
fi
cp *.log bak
$ chmod +x backup
chmod +x <스크립트파일> 명령으로 권한변경후
"./<스크립트파일>" 명령으로 실행
crontab =================================================
systemcrl status crond (상태확인)
workspace $ vi /etc/crontab
workspace $ cd /etc/cron.monthly/
/etc/cron.monthly $ pwd
/etc/cron.monthly
/etc/cron.monthly $ vi mybackup.sh
#!/bin/sh
set $(date)
#$2 : 월 , $3 : 일
fname ="backup-$2$3.tar.xz"
tar cvfJ /backup/$fname /home
mkdir /backup
chmod ugo+x myBackup.sh
systemctl restart crond
sh =====================================
#!bin/sh
set $(date)
echo $(date)
echo $0
echo $1
echo $2
echo $3
echo $4
exit 0