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. #AUTHOR [email protected]
  15.  
  16. start_something(){
  17. #start an application using
  18. # &
  19. # nohup
  20. # ... and so on
  21. }
  22.  
  23. stop_something(){
  24. killall process_name
  25. }
  26. case "$1" in
  27. start)
  28. start_something
  29. ;;
  30. stop)
  31. stop_something
  32. ;;
  33. restart|force-reload)
  34. stop_something
  35. start_something
  36. ;;
  37. *)
  38. echo "missing parameter start | stop | restart"
  39. exit 1
  40. ;;
  41. esac
  42.  
  43. exit 0

Report this snippet  

You need to login to post a comment.