Posted By

dalcacer on 10/07/10


Tagged


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

dalcacer
konteck


init.d Template


 / Published in: Bash
 

  1. #! /bin/sh
  2.  
  3. ### BEGIN INIT INFO
  4. # Provides: app_d
  5. # Required-Start:
  6. # Required-Stop:
  7. # Should-Start: app_d
  8. # Default-Start: 3
  9. # Default-Stop: 1
  10. # Short-Description: provides a daemonlike execution of xyz
  11. # Description: provides a daemonlike execution of xyz
  12. ### END INIT INFO
  13. #VERSION 0.2
  14.  
  15. start_something(){
  16. #start an application using
  17. # &
  18. # nohup
  19. # ... and so on
  20. }
  21.  
  22. stop_something(){
  23. killall process_name
  24. }
  25. case "$1" in
  26. start)
  27. start_something
  28. ;;
  29. stop)
  30. stop_something
  31. ;;
  32. restart|force-reload)
  33. stop_something
  34. start_something
  35. ;;
  36. *)
  37. echo "missing parameter start | stop | restart"
  38. exit 1
  39. ;;
  40. esac
  41.  
  42. exit 0

Report this snippet  

You need to login to post a comment.