쉘 스크립트두 암것두 모르구..
postgres에 대해서두 거의 무지한 상태루..
자동 백업-_-을 해 본다구 이것저것 뒤져가면서 작성을 했는데요..
그게 아래와 같습니다..
일단, 디렉토리 생겼구, 파일두 제대로 왔는데..
궁금한 건요..
1번을 2번으루 바꾸면 안되는데,
$의 사용에 어떤 문제가 있는 거죠?
워낙에 기초를 모르다보니....^^;;;;;;
답변 목 빼구 기다리구 있을게요~~~
1 번 ----------------------------------
#!/bin/bash
# Change the language
LANG = C
export LANG
# Copy and compress the dump file
su postgres -c "/usr/local/pgsql/bin/pg_dump testdb | gzip > /home/postgres/backup_db/test/db.dmp.gz"
# Copy the backup data
WEEK=`/bin/date "+%a"`
mkdir -p /home/postgres/backup_db/$WEEK
mv /home/postgres/backup_db/test/* /home/postgres/backup_db/$WEEK/.
---------------------------
2번 ---------------------------
#!/bin/bash
# Change the language
LANG = C
export LANG
# table_DUMP
table_DUMP = "/home/postgres/backup_db/test/db.dmp.gz"
# Copy and compress the dump file
su postgres -c "/usr/local/pgsql/bin/pg_dump testdb | gzip > $table_DUMP"
# Copy the backup data
WEEK=`/bin/date "+%a"`
mkdir -p /home/postgres/backup_db/$WEEK
mv $table_DUMP /home/postgres/backup_db/$WEEK/.
---------------------------
|