Pureftpd-init 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. #!/bin/bash
  2. #
  3. # Startup script for the pure-ftpd FTP Server $Revision: 1.3 $
  4. #
  5. # chkconfig: 2345 85 15
  6. # Default-Start: 2 3 4 5
  7. # Default-Stop: 0 1 6
  8. # description: Pure-FTPd is an FTP server daemon based upon Troll-FTPd
  9. # processname: pure-ftpd
  10. # pidfile: /var/run/pure-ftpd.pid
  11. # config: /usr/local/pureftpd/etc/pure-ftpd.conf
  12. # Source function library.
  13. . /etc/rc.d/init.d/functions
  14. RETVAL=0
  15. # Path to the pure-ftp binaries.
  16. prog=pure-config.pl
  17. fullpath=/usr/local/pureftpd/sbin/$prog
  18. pureftpwho=/usr/local/pureftpd/sbin/pure-ftpwho
  19. pure_config=/usr/local/pureftpd/etc/pure-ftpd.conf
  20. start() {
  21. echo -n $"Starting $prog: "
  22. $fullpath $pure_config --daemonize
  23. RETVAL=$?
  24. [ $RETVAL = 0 ] && touch /var/lock/subsys/$prog
  25. echo
  26. }
  27. stop() {
  28. echo -n $"Stopping $prog: "
  29. kill $(cat /var/run/pure-ftpd.pid)
  30. RETVAL=$?
  31. [ $RETVAL = 0 ] && rm -f /var/lock/subsys/$prog
  32. echo
  33. }
  34. # See how we were called.
  35. case "$1" in
  36. start)
  37. start
  38. ;;
  39. stop)
  40. stop
  41. ;;
  42. restart)
  43. stop
  44. start
  45. ;;
  46. condrestart)
  47. if [ -f /var/lock/subsys/$prog ] ; then
  48. stop
  49. # avoid race
  50. sleep 3
  51. start
  52. fi
  53. ;;
  54. status)
  55. status $prog
  56. RETVAL=$?
  57. if [ -f $pureftpwho ] && [ $RETVAL -eq 0 ] ; then
  58. $pureftpwho
  59. fi
  60. ;;
  61. *)
  62. echo $"Usage: $prog {start|stop|restart|condrestart|status}"
  63. RETVAL=1
  64. esac
  65. exit $RETVAL