Advertisement
Guest User

Untitled

a guest
Sep 21st, 2014
276
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 3.21 KB | None | 0 0
  1. #!/bin/sh
  2. #
  3. # Startup script for ProFTPd
  4. #
  5. # chkconfig: 345 85 15
  6. # description: ProFTPD is an enhanced FTP server with \
  7. #               a focus toward simplicity, security, and ease of configuration. \
  8. #              It features a very Apache-like configuration syntax, \
  9. #               and a highly customizable server infrastructure, \
  10. #               including support for multiple 'virtual' FTP servers, \
  11. #               anonymous FTP, and permission-based directory visibility.
  12. # processname: proftpd
  13. # config: /etc/proftpd.conf
  14. #
  15. ### BEGIN INIT INFO
  16. # Provides: proftpd
  17. # Required-Start: $network
  18. # Required-Stop: $network
  19. # Should-Start: mysqld postgresql radiusd ldap
  20. # Should-Stop: mysqld postgresql radiusd ldap
  21. # Default-Start: 3 4 5
  22. # Short-Description: ProFTPD FTP server
  23. # description: ProFTPD is an enhanced FTP server with
  24. #              a focus toward simplicity, security, and ease of configuration.
  25. #              It features a very Apache-like configuration syntax,
  26. #              and a highly customizable server infrastructure,
  27. #              including support for multiple 'virtual' FTP servers,
  28. #              anonymous FTP, and permission-based directory visibility.
  29. ### END INIT INFO
  30.  
  31. # Source function library.
  32. . /etc/rc.d/init.d/functions
  33.  
  34. # source network configuration
  35. . /etc/sysconfig/network
  36.  
  37. # Check that networking is up.
  38. [ ${NETWORKING} = "no" ] && exit 0
  39.  
  40. NAME=proftpd
  41. FTPSHUT=/usr/sbin/ftpshut
  42. LOCKFILE=/var/lock/subsys/$NAME
  43. RETVAL=0
  44.  
  45. start() {
  46.     # Check if it is already running
  47.     if [ ! -f $LOCKFILE ]; then
  48.         gprintf "Starting %s" "$NAME"
  49.         daemon "proftpd" 2>/dev/null
  50.         RETVAL=$?
  51.         [ $RETVAL -eq 0 ] && touch $LOCKFILE
  52.         echo
  53.     fi
  54. }
  55.  
  56. stop() {
  57.     gprintf "Stopping %s" "$NAME"
  58.     killproc proftpd
  59.     RETVAL=$?
  60.     [ $RETVAL -eq 0 ] && rm -f $LOCKFILE
  61.     echo
  62. }
  63.  
  64. reload() {
  65.     gprintf "Reloading %s" "$NAME"
  66.     killproc proftpd -HUP
  67.     RETVAL=$?
  68.     echo
  69. }
  70.  
  71. suspend() {
  72.     if [ $# -gt 1 ]; then
  73.         shift
  74.         gprintf "Suspending proftpd with '$*' "
  75.         $FTPSHUT $*
  76.     else
  77.         gprintf "Suspending proftpd NOW "
  78.         $FTPSHUT now "Maintenance in progress"
  79.     fi
  80.     killproc proftpd
  81.     RETVAL=$?
  82.     echo
  83.     [ $RETVAL -eq 0 ] && rm -f $LOCKFILE
  84. }
  85.  
  86. resume() {
  87.     if [ -f /etc/shutmsg ]; then
  88.         gprintf "Allowing proftpd sessions again "
  89.         rm -f /etc/shutmsg
  90.     else
  91.         gprintf "Starting proftpd; was not suspended "
  92.         fi
  93.     daemon "proftpd >/dev/null 2>&1"
  94.     RETVAL=$?
  95.     echo
  96.     [ $RETVAL -eq 0 ] && touch $LOCKFILE
  97. }
  98.  
  99. # See how we were called.
  100. case "$1" in
  101.     start)
  102.         start
  103.         ;;
  104.     stop)
  105.         stop
  106.         ;;
  107.     status)
  108.         status proftpd
  109.         RETVAL=$?
  110.         ;;
  111.     restart)
  112.         stop
  113.         start
  114.         ;;
  115.     condrestart)
  116.         if [ -f $LOCKFILE ]; then
  117.             stop
  118.             start
  119.         fi
  120.         ;;
  121.     reload)
  122.         reload
  123.         ;;
  124.     suspend)
  125.         suspend
  126.         ;;
  127.     resume)
  128.         resume
  129.         ;;
  130.     *)
  131.         gprintf "Usage: %s {start|stop|status|restart|condrestart|reload|resume|suspend} [time]" "$0"
  132.         exit 1
  133. esac
  134.  
  135. exit $RETVAL
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement