Advertisement
sandervanvugt

ITGG scripting 2

Nov 25th, 2020
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.04 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. echo this is done before the reboot
  4. echo to prepare anything that you want to do
  5. [ -f /tmp/after-reboot ] && rm -f /tmp/after-reboot
  6.  
  7. cat << REBOOT >> /root/completeme.sh
  8. touch /tmp/after-reboot
  9.  
  10. rm -f /etc/profile
  11. mv /etc/profile.bak /etc/profile
  12. echo DONE
  13. REBOOT
  14.  
  15. chmod +x /root/completeme.sh
  16. cp /etc/profile /etc/profile.bak
  17. echo /root/completeme.sh >> /etc/profile
  18.  
  19. [ -f /tmp/after-reboot ] && echo testfile exists && exit 9
  20. echo we now know that testfile does not exist
  21.  
  22. reboot
  23.  
  24. #######[student@localhost bash-scripting]$ history
  25. 1 sudo dnf install -y git vim
  26. 2 git clone https://github.com/sandervanvugt/ckad
  27. 3 cd ckad/
  28. 4 ls
  29. 5 ./kube-setup.sh
  30. 6 sudo reboot
  31. 7 cd bash-scripting/
  32. 8 ./countdown 3
  33. 9 tail ckad/kube-setup.sh
  34. 10 minikube start --memory 4096 --vm-driver=kvm2
  35. 11 git clone https://github.com/sandervanvugt/bash-scripting
  36. 12 cd bash
  37. 13 cd bash-scripting/
  38. 14 ls
  39. 15 vim script1
  40. 16 ls
  41. 17 echo $?
  42. 18 ls ioehrgoiheriog
  43. 19 echo $?
  44. 20 ls /root/
  45. 21 echo $?
  46. 22 script1
  47. 23 echo $PATH
  48. 24 pwd
  49. 25 ./script1
  50. 26 ls -l
  51. 27 chmod +x script*
  52. 28 ./script1
  53. 29 vim script2
  54. 30 ./script2
  55. 31 cat script2
  56. 32 pwd
  57. 33 source script2
  58. 34 cd -
  59. 35 . script2
  60. 36 sudo dnf search network-scripts
  61. 37 sudo dnf install network-scripts
  62. 38 vim /etc/init.d/network
  63. 39 vim script2b
  64. 40 vim colors
  65. 41 chmod +x script2b
  66. 42 ./script2b
  67. 43 vim colors
  68. 44 ./script2b
  69. 45 cat script2b
  70. 46 cat colors
  71. 47 ls
  72. 48 vim script3
  73. 49 ./script3 a b c d e f g h i j k l m n b
  74. 50 cat script3
  75. 51 vim script4
  76. 52 ./script4 a b c d e
  77. 53 cat script4
  78. 54 vim script4
  79. 55 ./script4 a b c d e
  80. 56 vim script4
  81. 57 vim script5
  82. 58 cd /lib/modules
  83. 59 ls
  84. 60 uname -r
  85. 61 cd `uname -r`
  86. 62 cd -
  87. 63 cd $(uname -r)
  88. 64 cd
  89. 65 cd bash-scripting/
  90. 66 ls
  91. 67 vim script6
  92. 68 cat script6
  93. 69 ./script6 /usr/bin/blah
  94. 70 vim script6
  95. 71 ./script6 /usr/bin/blah
  96. 72 ./countdown 12
  97. 73 vim countdown
  98. 74 ./countdown 0
  99. 75 vim countdown
  100. 76 vim script7
  101. 77 ./script7
  102. 78 vim script8
  103. 79 sudo useradd alex
  104. 80 ./script8 alex
  105. 81 sudo useradd alexander
  106. 82 ./script8 alex
  107. 83 ./script8 lex
  108. 84 vim script8
  109. 85 ./script8 lex
  110. 86 ./script8 alex
  111. 87 vim script8
  112. 88 ./script8 alex
  113. 89 ./script8 lex
  114. 90 vim script8
  115. 91 ./script8 lex
  116. 92 ./script8 alex
  117. 93 vim script8
  118. 94 vim script9
  119. 95 man test
  120. 96 vim script9
  121. 97 ./script9
  122. 98 echo $?
  123. 99 vim script9
  124. 100 ./script9
  125. 101 echo $?
  126. 102 vim script9b
  127. 103 chmod +x script9b
  128. 104 ./script9b
  129. 105 ./script9b j
  130. 106 vim script9b
  131. 107 ./script9b blah
  132. 108 ./script9b /etc
  133. 109 ./script9b /etc/hosts
  134. 110 vim script9b
  135. 111 ./script9b /etc
  136. 112 ./script9b /etc/hosts
  137. 113 vim script9b
  138. 114 ./script9b /etc/hosts
  139. 115 vim script9b
  140. 116 ./script9b /etc/hosts
  141. 117 vim script9b
  142. 118 [-f /etc/hosts] && echo its a file
  143. 119 history
  144. 120 cat script9b
  145. 121 vim script10
  146. 122 ./countdown 12
  147. 123 vim script10
  148. 124 ./script10
  149. 125 bash -x script10
  150. 126 vim script10
  151. 127 ./script10
  152. 128 bash -x ./script10
  153. 129 vim script10
  154. 130 ./script10 1
  155. 131 vim script10
  156. 132 ./script10 1
  157. 133 vim script10
  158. 134 ./script10 5
  159. 135 vim script10
  160. 136 man test
  161. 137 vim script10
  162. 138 vim script11
  163. 139 ./script11
  164. 140 vim script11
  165. 141 echo hello | tr a-z A-Z
  166. 142 echo hello | tr [:lower:] [:upper:]
  167. 143 vim script11
  168. 144 ./script11
  169. 145 vim script11
  170. 146 vim script11b
  171. 147 chmod +x script11b
  172. 148 ./script11b
  173. 149 vim script11
  174. 150 ls
  175. 151 vim reboot-test.sh
  176. 152 sudo reboot-test.sh
  177. 153 sudo -i
  178. 154 cd bash-scripting/
  179. 155 ls
  180. 156 cat reboot-test.sh
  181. 157 history
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement