본문 바로가기

카테고리 없음

linux cron 설정.

[root@LOGiMASON /]# crontab -e
*/1 * * * * /usr/bin/lynx --dump http://www.logimason.com/ipforward_XXX.php > /mason_ip.txt
40 04 * * * /bin/sync
00 05 * * 1 /Backup.sh /HDD1/data/backup1/
00 05 * * 2 /Backup.sh /HDD1/data/backup2/
00 05 * * 3 /Backup.sh /HDD2/data/backup1/
00 05 * * 4 /Backup.sh /HDD2/data/backup2/
00 05 * * 5 /Backup.sh /HDD3/data/backup1/
00 05 * * 6 /Backup.sh /HDD3/data/backup2/
00 05 * * 7 /Backup.sh /HDD1/data/backup1/

 

[root@LOGiMASON /]# vi Backup.sh
#!/bin/bash
 echo
 echo iptime
 echo ---------------------------------------------
 echo Backup.sh HDDno WeekNum
 echo ex. Backup.sh 1 0
 echo ex.        HDD1 Backup0
 echo ex. HDD1[0,1],HDD2[2,3],DD3[4,5],HDD4[6,X]
 echo ---------------------------------------------
      cd /
      rm -rf *.sql
      rm -rf *.tar
 echo Backup MysqlDB xe_new
      mysqldump -uokchang1 -pok85307618 okchang1 > /sqldata_xe_new.sql
 echo Backup MysqlDB xe
      mysqldump -uokchang0 -pok85307618 okchang0 > /sqldata_xe.sql
 echo tar backup.tar
      tar cvf cron.tar /var/spool/cron/root
      tar cvf sql.tar /*.sql
      tar cvf shell.tar /*.sh
      tar cvf html.tar /var/www
      tar cvf project.tar /Project/Project
      tar cvf sajin.tar /Project/Sajin
      chmod 777 *.tar

 echo connect FTP
      HOST=192.168.1.3
      USER=admin
      PASS=admin
      /usr/kerberos/bin/ftp -inv $HOST << EOF
      user $USER $PASS
      bin
      lcd /
      cd $1
      mput *.tar
      bye
EOF
~

service crond restart