วันอังคาร, ธันวาคม 13, 2548

startup scritp vsftpd บน solaris9

จากที่ผ่านมาได้มีการลง vsftpd server บน solaris9 พบว่ามีปัญหาเกิดขึ้นเมื่อ user ทำการ reboot เครื่องแล้ว service vsftpd ไม่ได้ start (ที่มันไม่ start เพราะไม่ได้ใส่ไว้อ่ะดิ)

เลยมาทำการแ ก้ปัญหาให้ user โดยจัดการให้ ตอนแรกว่าจะใส่ใน rc.local ง่ายดี พบว่ามันไม่มีนี่หว่า สุดท้ายพบว่าต้องมาเขียนเองซะแล้ว ใครมีหนทางที่ดีกว่านี้เสนอมาหน่อยเถอะ เกิดมี service ที่ต้องใสใ่เข้าไปอีก มาเขียนตลอดคงไม่ไหว


ขั้นแรกเขียน rc script ขึ้นมาซะ โดยมีรายละเอียดดังนี้ (เอา mysql script บางส่วนมาเป็นแนวทาง)

#!/bin/bash
# Copyright Sudkhet C. 2005
# This file is public domain and comes with NO WARRANTY of any kind

# vsftpd daemon start/stop script.

# Usually this is put in /etc/init.d (at least on machines SYSV R4 based
# systems) and linked to /etc/rc3.d/S51vsftpd and /etc/rc0.d/K07vsftpsd.
# When this is done the vsftpd server will be started when the machine is
# started and shut down when the systems goes down.
exec_daemon=/usr/sbin/vsftpd
conf_daemon=/etc/vsftpd/vsftpd.conf
pid_file=/var/run/vsftpd.pid

case "$1" in

start)
# Start daemon.
$exec_daemon $conf_daemon &
pid=$!
echo $pid > $pid_file
echo "Start vsftpd Done!."
;;

stop)
# Stop daemon. We use a signal here to avoid having to know the
if test -s "$pid_file"
then
vsftpd_pid=`cat $pid_file`
echo "Killing vsftpd with pid $vsftpd_pid"
kill $vsftpd_pid
# vsftpd should remove the pid_file when it exits, so wait for it.

sleep 1
while [ -s $pid_file -a "$flags" != aaaaaaaaaaaaaa ]
do
[ -z "$flags" ] && echo $echo_n "Wait for vsftpd to exit$echo_c" || echo $echo_n ".$echo_c"
flags=a$flags
sleep 1
done

if [ -s $pid_file ]
then echo " gave up waiting!"
elif [ -n "$flags" ]
then echo " done"
fi
# delete lock for RedHat / SuSE
if test -f $pid_file
then
rm -f $pid_file
fi
else
echo "No vsftpd pid file found. Looked for $pid_file."
fi
;;

*)
# usage
echo "Usage: $0 start|stop|restart"
exit 1
;;
esac

  1. จากนั้นก็ save ในชื่อ vsftpd แล้วเอาไปไว้ที่ /etc/init.d/vsftpd
  2. ทำการ change mode และ permission โดยสั่งดังนี้
    # chmod 744 vsftpd
    # chown root:sys vsftpd
  3. จากนั้นให้เพิ่มในส่วนของ startup และ shutdown ที่อยู่ใน rc โดยทำดังนี้
    # cp vsftpd /etc/rc3.d/S51vsftpd
    # cp vsftpd /etc/rc0.d/K17vsftpd
    # chown root:sys /etc/rc3.d/S51vsftpd
    # chown root:sys /etc/rc0.d/K17vsftpd
  4. จากนั้นลอง reboot เครื่องทดสอบพบว่าใช้การได้ดี


มีข้อผิดพลาดตรงไหน กรุณาบอกกล่าวด้วย

1 ความคิดเห็น:

ไม่ระบุชื่อ กล่าวว่า...

Hello,

When ever I surf on web I come to this website[url=http://www.weightrapidloss.com/lose-10-pounds-in-2-weeks-quick-weight-loss-tips].[/url]Plenty of useful information on zendz.blogspot.com. Let me tell you one thing guys, some time we really forget to pay attention towards our health. Here is a fact for you. Recent Research shows that closely 90% of all United States adults are either obese or weighty[url=http://www.weightrapidloss.com/lose-10-pounds-in-2-weeks-quick-weight-loss-tips].[/url] Therefore if you're one of these people, you're not alone. In fact, most of us need to lose a few pounds once in a while to get sexy and perfect six pack abs. Now next question is how you can achive quick weight loss? Quick weight loss can be achived with little effort. Some improvement in of daily activity can help us in losing weight quickly.

About me: I am author of [url=http://www.weightrapidloss.com/lose-10-pounds-in-2-weeks-quick-weight-loss-tips]Quick weight loss tips[/url]. I am also mentor who can help you lose weight quickly. If you do not want to go under hard training program than you may also try [url=http://www.weightrapidloss.com/acai-berry-for-quick-weight-loss]Acai Berry[/url] or [url=http://www.weightrapidloss.com/colon-cleanse-for-weight-loss]Colon Cleansing[/url] for effective weight loss.