#!/bin/sh

#Add to /etc/rc.d/rc.local for auto startup: pure-ftpd -EbBADHk 90
if [ "$(ps | grep $(cat /var/run/pure-ftpd.pid) | grep pure-ftpd)" != "" ] ; then

Xdialog --wmclass "pure-ftpd" --title "Pure-FTPDの開始/停止" --stdout --ok-label "サーバーを停止" --cancel-label "キャンセル" --yesno "Pure-FTPDは動作中です。 \n サーバーを停止しますか？" 0 0

 if  [ "$?" = "1" ] ;then  
 exit
 fi
 kill -9 $(cat /var/run/pure-ftpd.pid)
 exit
fi
vMsgH=15 ; vMsg=''
	vMsgW=40
	cfg=`Xdialog --title "$vServerTitle Pure-FTPDの開始/停止" \
			--backtitle "Pure-FTPDは現在実行されていません。" \
			--left --separator \  \
			--ok-label "Pure-ftpdを開始" \
			--checklist " " \
		15 85 4 \
		'-u 1' "ユーザによるroot接続を防止します。" off \
		'-E' "匿名での接続を防止します。" on \
		2>&1 || echo .`
	[ "$cfg" == "." ] && exit
		
pure-ftpd -bBADHk 90 $cfg
 
Xdialog --wmclass "pure-ftpd" --title "Pure-FTPDの開始/停止" --stdout --ok-label "OK" --infobox "Pure-ftpd is started. \n If you allowed anonymous connections, web browsers will connect as user ftp. \n User ftp's home directory is at /root/ftpd. \n If you allowed root logins you should set a root password. \n To set a password for root, open a terminal and type passwd. \n To stop the server run this script again." 0 0 90000


 