Guest User

Untitled

a guest
Sep 21st, 2014
326
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 3.13 KB | None | 0 0
  1. #! /bin/sh
  2. # Copyright (c) 2000-2001 SuSE GmbH Nuernberg, Germany.
  3. # All rights reserved.
  4. #
  5. # Original author: Marius Tomaschewski <[email protected]>
  6. #
  7. # Slightly modified in 2003 for use with SuSE Linux 8.1,
  8. # by http://www.learnlinux.co.uk/
  9. #
  10. # Slightly modified in 2005 for use with SuSE Linux 9.2,
  11. # by Falko Timme
  12. #
  13. # /etc/init.d/proftpd
  14. #
  15. ### BEGIN INIT INFO
  16. # Provides:                proftpd
  17. # Required-Start:        $network $remote_fs $syslog $named
  18. # Required-Stop:
  19. # Default-Start:        3 5
  20. # Default-Stop:        0 1 2 6
  21. # Description:                Starts ProFTPD server
  22. ### END INIT INFO
  23. # Determine the base and follow a runlevel link name.
  24. base=${0##*/}
  25. link=${base#*[SK][0-9][0-9]}
  26. # Force execution if not called by a runlevel directory.
  27. test $link = $base && START_PROFTPD=yes  # Modified by learnlinux.co.uk
  28. test "$START_PROFTPD" = yes || exit 0    # Modified by learnlinux.co.uk
  29. # Return values acc. to LSB for all commands but
  30. # status (see below):
  31. #
  32. # 0 - success
  33. # 1 - generic or unspecified error
  34. # 2 - invalid or excess argument(s)
  35. # 3 - unimplemented feature (e.g. "reload")
  36. # 4 - insufficient privilege
  37. # 5 - program is not installed
  38. # 6 - program is not configured
  39. # 7 - program is not running
  40. proftpd_cfg="/etc/proftpd.conf"
  41. proftpd_bin="/usr/local/sbin/proftpd"
  42. proftpd_pid="/usr/local/var/proftpd.pid"
  43. [ -r $proftpd_cfg ] || exit 6
  44. [ -x $proftpd_bin ] || exit 5
  45. # Source status functions
  46. . /etc/rc.status
  47. # First reset status of this service
  48. rc_reset
  49. case "$1" in
  50.     start)
  51.   echo -n "Starting ProFTPD Server: "
  52.   test -f /etc/shutmsg && rm -f /etc/shutmsg
  53.   /sbin/startproc $proftpd_bin
  54.   rc_status -v
  55.   ;;
  56.     stop)
  57.   echo -n "Shutting down ProFTPD Server: "
  58.   test -x /usr/local/sbin/ftpshut && /usr/local/sbin/ftpshut now && sleep 1
  59.   /sbin/killproc -TERM $proftpd_bin
  60.   test -f /etc/shutmsg && rm -f /etc/shutmsg
  61.   rc_status -v
  62.   ;;
  63.     restart)
  64.   ## If first returns OK call the second, if first or
  65.   ## second command fails, set echo return value.
  66.   $0 stop
  67.   $0 start
  68.   rc_status
  69.   ;;
  70.     try-restart)
  71.   ## Stop the service and if this succeeds (i.e. the
  72.   ## service was running before), start it again.
  73.   ## Note: not (yet) part of LSB (as of 0.7.5)
  74.   $0 status >/dev/null &&  $0 restart
  75.   rc_status
  76.   ;;
  77.     reload|force-reload)
  78.   ## Exclusive possibility: Some services must be stopped
  79.   ## and started to force a new load of the configuration.
  80.   echo -n "Reload ProFTPD Server: "
  81.   /sbin/killproc -HUP $proftpd_bin
  82.   rc_status -v
  83.   ;;
  84.     status)
  85.   # Status has a slightly different for the status command:
  86.   # 0 - service running
  87.   # 1 - service dead, but /var/run/  pid  file exists
  88.   # 2 - service dead, but /var/lock/ lock file exists
  89.   # 3 - service not running
  90.   echo -n "Checking for ProFTPD Server: "
  91.   checkproc $proftpd_bin
  92.   rc_status -v
  93.   ;;
  94.     probe)
  95.   ## Optional: Probe for the necessity of a reload,
  96.   ## give out the argument which is required for a reload.
  97.   [ $proftpd_cfg -nt $proftpd_pid ] && echo reload
  98.   ;;
  99.     *)
  100.   echo "Usage: $0 {start|stop|status|restart|reload|try-restart|probe}"
  101.   exit 1
  102.   ;;
  103. esac
  104. # Set an exit status.
  105. rc_exit
Advertisement
Add Comment
Please, Sign In to add comment