Guest User

Untitled

a guest
Jan 23rd, 2018
305
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.32 KB | None | 0 0
  1. [sun@example noip-2.1.9-1]$ cat redhat.noip.sh
  2. #!/bin/sh
  3. #
  4. # chkconfig: 345 99 80
  5. # description: Starts and stops the no-ip.com Dynamic dns client daemon
  6. #
  7. # pidfile: /var/run/noipd.pid
  8. #
  9. # Written by serge@vanginderachter.be and tested on Redhat 8
  10. # ... and debugged by Uwe Dippel
  11. # 29-03-2003
  12. #
  13. # Source function library.
  14. if [ -f /etc/init.d/functions ] ; then
  15. . /etc/init.d/functions
  16. elif [ -f /etc/rc.d/init.d/functions ] ; then
  17. . /etc/rc.d/init.d/functions
  18. else
  19. exit 0
  20. fi
  21.  
  22. # Avoid using root's TMPDIR
  23. unset TMPDIR
  24.  
  25. # Source networking configuration.
  26. . /etc/sysconfig/network
  27.  
  28. # Check that networking is up.
  29. [ ${NETWORKING} = "no" ] && exit 0
  30.  
  31. RETVAL=0
  32.  
  33. start() {
  34. if [ -f /var/run/noipd.pid ] ; then
  35. echo "no-ip client daemon already started" && exit 0
  36. fi
  37. echo -n $"Starting no-ip client daemon: "
  38. daemon /usr/local/bin/noip2
  39. echo
  40. RETVAL=$?
  41. /sbin/pidof noip2 > /var/run/noipd.pid
  42. }
  43.  
  44. stop() {
  45. if [ -f /var/run/noipd.pid ] ; then
  46. echo -n $"Stopping no-ip client daemon: "
  47. killproc noip2 -TERM
  48. echo
  49. RETVAL=$?
  50. rm -f /var/run/noipd.pid
  51. else
  52. echo "no-ip client daemon is not running" && exit 0
  53. fi
  54. return $RETVAL
  55. }
  56.  
  57. restart() {
  58. stop
  59. start
  60. }
  61.  
  62. case "$1" in
  63. start)
  64. start
  65. ;;
  66. stop)
  67. stop
  68. ;;
  69. restart)
  70. restart
  71. ;;
  72. *)
  73. echo $"Usage: $0 {start|stop|restart}"
  74. exit 1
  75. esac
  76.  
  77. exit $?
  78. [sun@example noip-2.1.9-1]$
Add Comment
Please, Sign In to add comment