1
0

Pureftpd-init 1.7 KB

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