Diff
checker
テキスト
テキスト
画像
ドキュメント
Excel
フォルダ
Legal
Enterprise
デスクトップ
料金
ログイン
Diffchecker デスクトップのダウンロード
テキスト比較
2 つのテキスト ファイルの違いを見つける
ツール
履歴
表示
レイアウト
分割
統合
ライブエディター
空白の変更を非表示
未変更行を折りたたむ
折り返しなし
比較精度
スマート
構文
なし
外観を変更
処理
無視
テキスト変換
最初の差分へ移動
入力を編集
Diffchecker Desktop
Diffcheckerを実行する最も安全な方法。Diffchecker Desktopアプリを入手:あなたの差分はコンピューターから出ることはありません!
Desktopを入手
create_mail_user_SQL.sh
作成日
7 年前
差分は期限切れになりません
クリア
エクスポート
共有
説明
4 削除
行
合計
削除
文字
合計
削除
この機能を引き続き使用するには、アップグレードしてください
Diff
checker
Pro
価格を見る
110 行
すべてコピー
7 追加
行
合計
追加
文字
合計
追加
この機能を引き続き使用するには、アップグレードしてください
Diff
checker
Pro
価格を見る
110 行
すべてコピー
#!/usr/bin/env bash
#!/usr/bin/env bash
# Author: Zhang Huangbin (zhb _at_ iredmail.org)
# Author: Zhang Huangbin (zhb _at_ iredmail.org)
# Purpose: Import users to SQL database from plain text file.
# Purpose: Import users to SQL database from plain text file.
# Project: iRedMail (http://www.iredmail.org/)
# Project: iRedMail (http://www.iredmail.org/)
# -------------------------------------------------------------------
# -------------------------------------------------------------------
# Usage:
# Usage:
# * Edit these variables:
# * Edit these variables:
# STORAGE_BASE_DIRECTORY
# STORAGE_BASE_DIRECTORY
# DEFAULT_QUOTA='1024' # 1024 is 1GB
# DEFAULT_QUOTA='1024' # 1024 is 1GB
#
#
# * Run this script to generate SQL command used to create new user.
# * Run this script to generate SQL command used to create new user.
#
#
コピー
コピー済み
コピー
コピー済み
# # bash create_mail_user_SQL.sh user@domain.ltd plain_password
# # bash create_mail_user_SQL.sh user@domain.ltd plain_password
mail_quota
#
#
# It will print SQL commands on console directly, you can redirect the
# It will print SQL commands on console directly, you can redirect the
# output to a file for further use like this:
# output to a file for further use like this:
#
#
コピー
コピー済み
コピー
コピー済み
# # bash create_mail_user_SQL.sh user@domain.ltd plain_password
> output.sql
# # bash create_mail_user_SQL.sh user@domain.ltd plain_password
mail_quota
> output.sql
#
#
# * Import output.sql into SQL database like below:
# * Import output.sql into SQL database like below:
#
#
# # mysql -uroot -p
# # mysql -uroot -p
# mysql> USE vmail;
# mysql> USE vmail;
# mysql> SOURCE /path/to/output.sql;
# mysql> SOURCE /path/to/output.sql;
#
#
# # psql -d vmail
# # psql -d vmail
# sql> \i /path/to/output.sql;
# sql> \i /path/to/output.sql;
# --------- CHANGE THESE VALUES ----------
# --------- CHANGE THESE VALUES ----------
# Storage base directory used to store users' mail.
# Storage base directory used to store users' mail.
STORAGE_BASE_DIRECTORY="/var/vmail/vmail1"
STORAGE_BASE_DIRECTORY="/var/vmail/vmail1"
###########
###########
# Password
# Password
#
#
# Password scheme. Available schemes: BCRYPT, SSHA512, SSHA, MD5, NTLM, PLAIN.
# Password scheme. Available schemes: BCRYPT, SSHA512, SSHA, MD5, NTLM, PLAIN.
# Check file Available
# Check file Available
PASSWORD_SCHEME='SSHA512'
PASSWORD_SCHEME='SSHA512'
# Default mail quota (in MB).
# Default mail quota (in MB).
コピー
コピー済み
コピー
コピー済み
DEFAULT_QUOTA=
'1024'
DEFAULT_QUOTA=
$3
#
#
# Maildir settings
# Maildir settings
#
#
# Maildir style: hashed, normal.
# Maildir style: hashed, normal.
# Hashed maildir style, so that there won't be many large directories
# Hashed maildir style, so that there won't be many large directories
# in your mail storage file system. Better performance in large scale
# in your mail storage file system. Better performance in large scale
# deployment.
# deployment.
# Format: e.g. username@domain.td
# Format: e.g. username@domain.td
# hashed -> domain.ltd/u/us/use/username/
# hashed -> domain.ltd/u/us/use/username/
# normal -> domain.ltd/username/
# normal -> domain.ltd/username/
# Default hash level is 3.
# Default hash level is 3.
MAILDIR_STYLE='hashed' # hashed, normal.
MAILDIR_STYLE='hashed' # hashed, normal.
コピー
コピー済み
コピー
コピー済み
if [ X"$#" != X'
2
' ]; then
if [ X"$#" != X'
3
' ]; then
echo "Invalid command arguments. Usage:"
echo "Invalid command arguments. Usage:"
コピー
コピー済み
コピー
コピー済み
echo "bash create_mail_user_SQL.sh user@domain.ltd plain_password
"
echo "bash create_mail_user_SQL.sh user@domain.ltd plain_password
mail_quota
"
exit 255
exit 255
fi
fi
# Time stamp, will be appended in maildir.
# Time stamp, will be appended in maildir.
DATE="$(date +%Y.%m.%d.%H.%M.%S)"
DATE="$(date +%Y.%m.%d.%H.%M.%S)"
WC_L='wc -L'
WC_L='wc -L'
if [ X"$(uname -s)" == X'OpenBSD' ]; then
if [ X"$(uname -s)" == X'OpenBSD' ]; then
WC_L='wc -l'
WC_L='wc -l'
fi
fi
STORAGE_BASE="$(dirname ${STORAGE_BASE_DIRECTORY})"
STORAGE_BASE="$(dirname ${STORAGE_BASE_DIRECTORY})"
STORAGE_NODE="$(basename ${STORAGE_BASE_DIRECTORY})"
STORAGE_NODE="$(basename ${STORAGE_BASE_DIRECTORY})"
# Read input
# Read input
mail="$1"
mail="$1"
plain_password="$2"
plain_password="$2"
username="$(echo $mail | awk -F'@' '{print $1}')"
username="$(echo $mail | awk -F'@' '{print $1}')"
domain="$(echo $mail | awk -F'@' '{print $2}')"
domain="$(echo $mail | awk -F'@' '{print $2}')"
# Cyrpt default password.
# Cyrpt default password.
export CRYPT_PASSWD="$(python ./generate_password_hash.py ${PASSWORD_SCHEME} ${plain_password})"
export CRYPT_PASSWD="$(python ./generate_password_hash.py ${PASSWORD_SCHEME} ${plain_password})"
# Different maildir style: hashed, normal.
# Different maildir style: hashed, normal.
if [ X"${MAILDIR_STYLE}" == X"hashed" ]; then
if [ X"${MAILDIR_STYLE}" == X"hashed" ]; then
length="$(echo ${username} | ${WC_L} )"
length="$(echo ${username} | ${WC_L} )"
str1="$(echo ${username} | cut -c1)"
str1="$(echo ${username} | cut -c1)"
str2="$(echo ${username} | cut -c2)"
str2="$(echo ${username} | cut -c2)"
str3="$(echo ${username} | cut -c3)"
str3="$(echo ${username} | cut -c3)"
test -z "${str2}" && str2="${str1}"
test -z "${str2}" && str2="${str1}"
test -z "${str3}" && str3="${str2}"
test -z "${str3}" && str3="${str2}"
# Use mbox, will be changed later.
# Use mbox, will be changed later.
maildir="${domain}/${str1}/${str2}/${str3}/${username}-${DATE}/"
maildir="${domain}/${str1}/${str2}/${str3}/${username}-${DATE}/"
else
else
maildir="${domain}/${username}-${DATE}/"
maildir="${domain}/${username}-${DATE}/"
fi
fi
cat <<EOF
cat <<EOF
保存された差分
原文
ファイルを開く
#!/usr/bin/env bash # Author: Zhang Huangbin (zhb _at_ iredmail.org) # Purpose: Import users to SQL database from plain text file. # Project: iRedMail (http://www.iredmail.org/) # ------------------------------------------------------------------- # Usage: # * Edit these variables: # STORAGE_BASE_DIRECTORY # DEFAULT_QUOTA='1024' # 1024 is 1GB # # * Run this script to generate SQL command used to create new user. # # # bash create_mail_user_SQL.sh user@domain.ltd plain_password # # It will print SQL commands on console directly, you can redirect the # output to a file for further use like this: # # # bash create_mail_user_SQL.sh user@domain.ltd plain_password > output.sql # # * Import output.sql into SQL database like below: # # # mysql -uroot -p # mysql> USE vmail; # mysql> SOURCE /path/to/output.sql; # # # psql -d vmail # sql> \i /path/to/output.sql; # --------- CHANGE THESE VALUES ---------- # Storage base directory used to store users' mail. STORAGE_BASE_DIRECTORY="/var/vmail/vmail1" ########### # Password # # Password scheme. Available schemes: BCRYPT, SSHA512, SSHA, MD5, NTLM, PLAIN. # Check file Available PASSWORD_SCHEME='SSHA512' # Default mail quota (in MB). DEFAULT_QUOTA='1024' # # Maildir settings # # Maildir style: hashed, normal. # Hashed maildir style, so that there won't be many large directories # in your mail storage file system. Better performance in large scale # deployment. # Format: e.g. username@domain.td # hashed -> domain.ltd/u/us/use/username/ # normal -> domain.ltd/username/ # Default hash level is 3. MAILDIR_STYLE='hashed' # hashed, normal. if [ X"$#" != X'2' ]; then echo "Invalid command arguments. Usage:" echo "bash create_mail_user_SQL.sh user@domain.ltd plain_password" exit 255 fi # Time stamp, will be appended in maildir. DATE="$(date +%Y.%m.%d.%H.%M.%S)" WC_L='wc -L' if [ X"$(uname -s)" == X'OpenBSD' ]; then WC_L='wc -l' fi STORAGE_BASE="$(dirname ${STORAGE_BASE_DIRECTORY})" STORAGE_NODE="$(basename ${STORAGE_BASE_DIRECTORY})" # Read input mail="$1" plain_password="$2" username="$(echo $mail | awk -F'@' '{print $1}')" domain="$(echo $mail | awk -F'@' '{print $2}')" # Cyrpt default password. export CRYPT_PASSWD="$(python ./generate_password_hash.py ${PASSWORD_SCHEME} ${plain_password})" # Different maildir style: hashed, normal. if [ X"${MAILDIR_STYLE}" == X"hashed" ]; then length="$(echo ${username} | ${WC_L} )" str1="$(echo ${username} | cut -c1)" str2="$(echo ${username} | cut -c2)" str3="$(echo ${username} | cut -c3)" test -z "${str2}" && str2="${str1}" test -z "${str3}" && str3="${str2}" # Use mbox, will be changed later. maildir="${domain}/${str1}/${str2}/${str3}/${username}-${DATE}/" else maildir="${domain}/${username}-${DATE}/" fi cat <<EOF INSERT INTO mailbox (username, password, name, storagebasedirectory,storagenode, maildir, quota, domain, active, passwordlastchange, created) VALUES ('${mail}', '${CRYPT_PASSWD}', '${username}', '${STORAGE_BASE}','${STORAGE_NODE}', '${maildir}', '${DEFAULT_QUOTA}', '${domain}', '1', NOW(), NOW()); INSERT INTO forwardings (address, forwarding, domain, dest_domain, is_forwarding) VALUES ('${mail}', '${mail}','${domain}', '${domain}', 1); EOF
変更されたテキスト
ファイルを開く
#!/usr/bin/env bash # Author: Zhang Huangbin (zhb _at_ iredmail.org) # Purpose: Import users to SQL database from plain text file. # Project: iRedMail (http://www.iredmail.org/) # ------------------------------------------------------------------- # Usage: # * Edit these variables: # STORAGE_BASE_DIRECTORY # DEFAULT_QUOTA='1024' # 1024 is 1GB # # * Run this script to generate SQL command used to create new user. # # # bash create_mail_user_SQL.sh user@domain.ltd plain_password mail_quota # # It will print SQL commands on console directly, you can redirect the # output to a file for further use like this: # # # bash create_mail_user_SQL.sh user@domain.ltd plain_password mail_quota > output.sql # # * Import output.sql into SQL database like below: # # # mysql -uroot -p # mysql> USE vmail; # mysql> SOURCE /path/to/output.sql; # # # psql -d vmail # sql> \i /path/to/output.sql; # --------- CHANGE THESE VALUES ---------- # Storage base directory used to store users' mail. STORAGE_BASE_DIRECTORY="/var/vmail/vmail1" ########### # Password # # Password scheme. Available schemes: BCRYPT, SSHA512, SSHA, MD5, NTLM, PLAIN. # Check file Available PASSWORD_SCHEME='SSHA512' # Default mail quota (in MB). DEFAULT_QUOTA=$3 # # Maildir settings # # Maildir style: hashed, normal. # Hashed maildir style, so that there won't be many large directories # in your mail storage file system. Better performance in large scale # deployment. # Format: e.g. username@domain.td # hashed -> domain.ltd/u/us/use/username/ # normal -> domain.ltd/username/ # Default hash level is 3. MAILDIR_STYLE='hashed' # hashed, normal. if [ X"$#" != X'3' ]; then echo "Invalid command arguments. Usage:" echo "bash create_mail_user_SQL.sh user@domain.ltd plain_password mail_quota" exit 255 fi # Time stamp, will be appended in maildir. DATE="$(date +%Y.%m.%d.%H.%M.%S)" WC_L='wc -L' if [ X"$(uname -s)" == X'OpenBSD' ]; then WC_L='wc -l' fi STORAGE_BASE="$(dirname ${STORAGE_BASE_DIRECTORY})" STORAGE_NODE="$(basename ${STORAGE_BASE_DIRECTORY})" # Read input mail="$1" plain_password="$2" username="$(echo $mail | awk -F'@' '{print $1}')" domain="$(echo $mail | awk -F'@' '{print $2}')" # Cyrpt default password. export CRYPT_PASSWD="$(python ./generate_password_hash.py ${PASSWORD_SCHEME} ${plain_password})" # Different maildir style: hashed, normal. if [ X"${MAILDIR_STYLE}" == X"hashed" ]; then length="$(echo ${username} | ${WC_L} )" str1="$(echo ${username} | cut -c1)" str2="$(echo ${username} | cut -c2)" str3="$(echo ${username} | cut -c3)" test -z "${str2}" && str2="${str1}" test -z "${str3}" && str3="${str2}" # Use mbox, will be changed later. maildir="${domain}/${str1}/${str2}/${str3}/${username}-${DATE}/" else maildir="${domain}/${username}-${DATE}/" fi cat <<EOF INSERT INTO mailbox (username, password, name, storagebasedirectory,storagenode, maildir, quota, domain, active, passwordlastchange, created) VALUES ('${mail}', '${CRYPT_PASSWD}', "$(echo ${username} | awk '{print toupper(substr($0,0,1))tolower(substr($0,2))}')", '${STORAGE_BASE}','${STORAGE_NODE}', '${maildir}', '${DEFAULT_QUOTA}', '${domain}', '1', NOW(), NOW()); INSERT INTO forwardings (address, forwarding, domain, dest_domain, is_forwarding) VALUES ('${mail}', '${mail}','${domain}', '${domain}', 1); EOF
違いを見つける