os/Linux

ftp 파일수신 쉘적용

C/H 2007. 3. 19. 10:47

#! /bin/sh
date=`date +%Y%m%d`
nd=`expr ${d} `

mkdir /home/domain.com/public_html/Backup/$date
chown -R useri_id /home/domain.com/public_html/Backup/$date
chgrp -R useri_id /home/domain.com/public_html/Backup/$date
# 1st data cleaner
mv -f /home/domain.com/public_html/Data/* /home/domain.com/public_html/Backup/$date/
cd /home/domain.com/public_html/Data/

ftp -n </home/domain.com/public_html/system/ftp_data.cmd
ftp -n </home/domain.com/public_html/system/ftp_data2.cmd

/bin/php /home/domain.com/public_html/newsXML/rss_reader.php
chown koglo /home/domain.com/public_html/newsXML/*.log
chgrp koglo /home/domain.com/public_html/newsXML/*.log

# 2nd data cleaner
mv -f /home/domain.com/public_html/Data/* /home/domain.com/public_html/Backup/$date/
chown -R useri_id /home/domain.com/public_html/Backup/$date
chgrp -R useri_id /home/domain.com/public_html/Backup/$date

+--------------------------------------------------------------------------------+
crontab 등록
50,20 * * * *      /home/koglo.com/public_html/system/ftp.sh              >       /dev/null

+--------------------------------------------------------------------------------+
$ cat ftp_data.cmd
#verbose
open ftp_address
user ftp_id ftp_password
prompt off
mget *.*
mdelete *.*
bye

반응형

'os > Linux' 카테고리의 다른 글

LDAP 일반정보  (0) 2007.04.03
유닉스, 리눅스에서 특정 디렉토리 지우기  (0) 2007.03.24
ftp text모드 사용법  (0) 2007.03.19
crontab 사용  (0) 2007.03.17
ncftp 사용  (0) 2007.03.17