⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 convert_db_to_unicode.sh

📁 opennms得相关源码 请大家看看
💻 SH
字号:
#!/bin/bashif [ "`id -u`" -ne "0" ]; then	echo "You must run this utility as root!"	exit 1fiif [ -z "$3" ]; then	echo "usage: $0 <postgres_user> <opennms_user> <database_name> [sql_file]"	exit 2fiPG_USER="$1"; shiftDB_USER="$1"; shiftDATABASE="$1"; shiftSQL_FILE="$1"; shiftLOG_FILE="/tmp/unicode-convert.log"if [ -z "$SQL_FILE" ]; then	SQL_FILE=@install.etc.dir@/create.sqlfiFILE="/tmp/pg_dump-${DATABASE}"echo "------------------------------------------------------------------------------" >> $LOG_FILEsleep 1print() {	echo -e "- $@... \c";	echo "`date` $@" >> $LOG_FILE}print "dumping data to $FILE"pg_dump -U $PG_USER -a -D $DATABASE > $FILE 2>>$LOG_FILEif [ $? -ne 0 ]; then	echo "failed"	exit 10fiecho "ok"sleep 1print "dropping old database"dropdb -U $PG_USER $DATABASE >>$LOG_FILE 2>&1if [ $? -ne 0 ]; then	echo "failed"	exit 20fiecho "ok"print "creating new unicode database"createdb -U $PG_USER -E UNICODE $DATABASE >>$LOG_FILE 2>&1if [ $? -ne 0 ]; then	echo "failed"	exit 30fiecho "ok"print "recreating tables..."psql -U $DB_USER -f $SQL_FILE $DATABASE >>$LOG_FILE 2>&1if [ $? -ne 0 ]; then	echo "failed"	exit 40fiecho "ok"print "restoring data..."psql -U $DB_USER -f $SQL_FILE $DATABASE >>$LOG_FILE 2>&1if [ $? -ne 0 ]; then	echo "failed"	exit 50fiecho "ok"

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -