daily pastebin goal
19%
SHARE
TWEET

Untitled

a guest Jul 30th, 2017 48 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/sh
  2.  
  3. PATH=/opt/bin:/opt/sbin:/sbin:/bin:/usr/sbin:/usr/bin
  4.  
  5. PIDFILE="/opt/var/run/dropbear.pid"
  6. PORT=22
  7. DROPBEAR="/opt/sbin/dropbear"
  8.  
  9.  
  10. dropbear_status ()
  11. {
  12.     [ -f $PIDFILE ] && [ -d /proc/`cat $PIDFILE` ]
  13. }
  14.  
  15. start()
  16. {
  17.     $DROPBEAR -p $PORT -P $PIDFILE
  18. }
  19.  
  20. stop()
  21. {
  22.     kill `cat $PIDFILE`
  23. }
  24. case "$1" in
  25.     start)
  26.         if dropbear_status
  27.         then
  28.             echo dropbear already running
  29.         else
  30.             start
  31.         fi
  32.         ;;
  33.     stop)
  34.         if dropbear_status
  35.         then
  36.             stop
  37.         else
  38.             echo dropbear is not running
  39.         fi
  40.         ;;
  41.     status)
  42.         if dropbear_status
  43.         then
  44.             echo dropbear already running
  45.         else
  46.             echo dropbear is not running
  47.         fi
  48.         ;;
  49.  
  50.     restart)
  51.         stop
  52.         sleep 3
  53.         start
  54.         ;;
  55.     *)
  56.         echo "Usage: $0 {start|stop|restart|status}"
  57.         ;;
  58. esac
RAW Paste Data
Top