-
Notifications
You must be signed in to change notification settings - Fork 3
/
Automation.py
212 lines (191 loc) · 7.87 KB
/
Automation.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
import os
import getpass
import pyfiglet
os.system("clear")
os.system('tput blink')
os.system('tput setaf 2')
print(pyfiglet.figlet_format("FSOCIETY"))
os.system('tput sgr0')
os.system('tput setaf 7')
print("Please Enter Fsociety Pass \n")
pas = getpass.getpass()
if(pas == "123"):
while True :
print('''\n --------Friday Automation manager--------
c:clear e:Exit the Program
1.LVM
2.Docker
3.Linux Basic
''')
print("Enter Your option : ",end="")
command = input()
if(command == "1"):
while True :
print('''\n --------LVM manager--------
c:clear e:Back to main menu
1.Show avialble devices/HDD
2.create Physical Volumes(PV)
3.Create Volume Group (VG)
4.Extend Volume Group
5.Create Logical Volume (LV)
6.Extend LV
7.Show physical volumes
8.Show volume groups
9.show LVM
10.List of HDD blocks
11.Mount LVM's
''')
print("Enter Your option : ",end="")
command = input()
if(command == "1"):
os.system("fdisk -l")
elif(command == "c"):
os.system("clear")
elif(command == "2"):
print("Enter device name :",end="")
pv = input()
os.system("pvcreate "+pv)
elif(command == "3"):
print("Enter volume group name : ",end="")
name =input()
print("Enter device name you want in LVM : ",end="")
dev1 = input()
os.system("vgcreate {} {} ".format(name,dev1))
elif(command == "4"):
print("Enter your new HDD name : ",end="")
hdd = input()
print("Enter your VG name : ",end="")
vgname = input()
os.system("vgextend {} {}".format(vgname,hdd))
elif(command == "5"):
print("How much size do you want[Ex.5G] : ",end="")
size = input()
print("Enter your Volume group name : ",end="")
vgname =input()
print("Enter name for LVM : ",end="")
lvmname = input()
os.system("lvcreate -L {} -n {} {}".format(size,lvmname,vgname))
elif(command =="6"):
print("Enter How much size do you wan to increase in GB [ex.5] : ",end="")
size=input()
print("Enter LVM device name : ",end="")
lvm = input()
os.system("lvextend --size +{}G {}".format(size,lvm))
os.system("resize2fs {}".format(lvm))
elif(command == "7"):
os.system("pvdisplay")
elif(command =="8"):
os.system("vgdisplay")
elif(command == "9"):
os.system("lvs")
elif(command == "10"):
os.system("lsblk")
elif(command == "11"):
print("Enter device name that will mount : ",end="")
mountname = input()
print("Enetr mount point : ",end="")
point = input()
os.system("mount {} {}".format(mountname,point))
elif(command =="e"):
os.system("clear")
break
elif(command == "c"):
os.system("clear")
elif(command == "e"):
break
elif(command == "2"):
while True :
print('''\n --------Docker manager--------
c:clear e:Back to main menu
install docker : to install docker
1.Display Images
2.Pull images
3.Display Container's
4.Launch Container
5.Start Container
6.attach container
7.stop Container
8.Remove Container
9.Remove Image
start: To start docker service
''')
print("Enter Your option : ",end="")
command = input()
if(command == "1"):
os.system("docker images")
elif(command == "install docker"):
os.system("yum install docker-ce --nobest")
elif(command == "c"):
os.system("clear")
elif(command == "e"):
os.system("clear")
break
elif(command == "2"):
print("Enter image you want to Download : ",end="")
image=input()
os.system("docker pull {}".format(image))
elif(command == "3"):
os.system("docker ps -a")
elif(command == "4"):
print("Enter any Container name : ",end="")
name = input()
print("Enter image name for launch : ",end="")
laun = input()
os.system("docker run -dit --name {} {}".format(name,laun))
elif(command == "5"):
print("Enter container name to start : ",end="")
container = input()
os.system("docker start {}".format(container))
elif(command == "6"):
print("Enter Container name to attach : ",end="")
cname = input()
os.system("docker attach {}".format(cname))
elif(command == "7"):
print("Enter Container name to stop : ",end="")
ename = input()
os.system("docker stop {}".format(ename))
elif(command =="8"):
print("Enter Container name to remove : ",end="")
rname = input()
os.system("docker rm {}".format(rname))
elif(command =="9"):
print("Enter image name to remove : ",end="")
iname = input()
os.system("docker image rm {}".format(iname))
elif(command == "start"):
os.system("systemctl start docker")
elif(command == "3"):
while True :
print('''\n --------Linux Manager--------
c:clear e:Back to main menu
1.date
2.list all things
3.working Directory
4.change directory
5.show memory
6.cpu info
7.show mounted volumes
''')
print("Enter Your option : ",end="")
command = input()
if(command == "1"):
os.system("date")
elif(command == "c"):
os.system("clear")
elif(command == "e"):
os.system("clear")
break
elif(command == "2"):
os.system("ls")
elif(command == "3"):
os.system("pwd")
elif(command == "4"):
print("Enter path to chnage directory : ",end="")
path = input()
os.system("cd {}".format(path))
elif(command == "5"):
os.system("free -h")
elif(command == "6"):
os.system("lscpu")
elif(command == "7"):
os.system("df -h")