aquaballoon

Managing services

Mar 24th, 2012
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.04 KB | None | 0 0
  1. #http://www.mehrdust.com/archives/managing-services-in-ubuntu
  2. #http://www.itmanage.info/technology/linux/ubuntu/enable%20disable%20service%20during%20start%20up%20in%20ubuntu.html
  3.  
  4. ### Services start ###
  5. /etc/init.d/myservice start/stop/restart
  6. or,
  7. service myservice start/stop/restart
  8.  
  9. ### Getting a list of Services ###
  10. ls /etc/init.d
  11. service --status-all
  12.  
  13. ls -l /etc/rc?.d/*apache2
  14. Runlevel 0: Halt System – To shutdown the system
  15. Runlevel 1: Single user mode
  16. Runlevel 2: Basic multi user mode without NFS
  17. Runlevel 3: Full multi user mode (text based)
  18. Runlevel 4: unused
  19. Runlevel 5: Multi user mode with Graphical User Interface
  20. Runlevel 6: Reboot System
  21.  
  22. ### Adding a Service to Default runlevels ###
  23. cp /etc/init.d/myscript.sh  << copy your script to /etc/init.d
  24. chmod +x /etc/init.d/myscript.sh
  25. update-rc.d myscript.sh defaults
  26.  
  27. update-rc.d apache2 defaults
  28. or,
  29. update-rc.d apache2 start 20 2 3 4 5 . stop 80 0 1 6 .
  30.  
  31. ### Removing a Service from Default runlevels ###
  32. rm /etc/rc*/*myscript
  33. or,
  34. update-rc.d -f apache2 remove
Advertisement
Add Comment
Please, Sign In to add comment