Advertisement
Guest User

Untitled

a guest
Aug 16th, 2017
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. switchrepo tdi
  2. cat >> /etc/init.d/yummy << EOF
  3. #!/bin/sh
  4.  
  5. # chkconfig: 345 99 01
  6. # description: Update yum on shutdown or reboot
  7.  
  8. lockfile=/var/lock/subsys/yummy
  9.  
  10. start () {
  11. touch $lockfile
  12. }
  13.  
  14. stop () {
  15. yum -y update
  16. [ -f "${lockfile}" ] && rm -f /var/lock/subsys/yummy
  17. }
  18.  
  19. case "$1" in
  20. start)
  21. start
  22. ;;
  23. stop)
  24. stop
  25. ;;
  26. restart)
  27. stop
  28. start
  29. ;;
  30. *)
  31. echo $"Usage: $0 {start|stop|restart}"
  32. esac
  33. EOF
  34. chmod +x /etc/init.d/yummy
  35. chkconfig --add yummy
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement