Skip to content

Commit

Permalink
python scripts added
Browse files Browse the repository at this point in the history
git-svn-id: file:///labs/ccnsb05/svn/Repo_CD_4@7 bb261590-0acd-428a-a52f-4eba15b8d69f
  • Loading branch information
swathy committed Sep 26, 2013
1 parent 1ba9301 commit c654280
Show file tree
Hide file tree
Showing 7 changed files with 89 additions and 0 deletions.
2 changes: 2 additions & 0 deletions python-scripts/backup
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/usr/bin/python
print "Dummy Script"
23 changes: 23 additions & 0 deletions python-scripts/build
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/python
## Build script
## inst_i denotes ith instruction
## if inst_i==0 than instruction is successful else not

import os
# Change Directory to source - src
inst_1=os.chdir("../src")
# Make src
inst_2=os.system("make all")
inst_3=os.system("cd ..")
# Copy files to web folder
inst_4=os.system("cp -r ../build/ /var/www/")
inst_5=os.system("chmod 777 /var/www/build/ -R")

if((inst_1 or inst_2 or inst_3 or inst_4 or inst_5)==0):
print "****************"
print "Build Successful"
print "****************"
else:
print "******************"
print "Build Unsuccessful"
print "******************"
2 changes: 2 additions & 0 deletions python-scripts/dependencies.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
php5
apache2
26 changes: 26 additions & 0 deletions python-scripts/initialise
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/python
## Initialize script
## inst_i denotes ith instruction
## if inst_i==0 than instruction is successful else not

import os
inst_1=os.system("export http_proxy=http://proxy.iiit.ac.in:8080/")
inst_2=os.system("apt-get update")
filen="dependencies.txt"
f=open(filen,"r")
dep=f.readlines()
f.close()
for pack in dep:
p=pack.strip()
inst_3=os.system("apt-get install -y "+p)

inst_4=os.system("./build")
if((inst_1 or inst_2 or inst_3 or inst_4)==0):
print "************************"
print "Intialization Successful"
print "************************"
else:
print "**************************"
print "Intialization Unsuccessful"
print "**************************"

2 changes: 2 additions & 0 deletions python-scripts/restore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/usr/bin/python
print "Dummy Script"
17 changes: 17 additions & 0 deletions python-scripts/shutdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/python
## Build script
## inst_i denotes ith instruction
## if inst_i==0 than instruction is successful else not

# Apache Server Stop
import os
inst_1=os.system("service apache2 stop")

if(inst_1==0):
print "********************"
print "Shutdown Successful"
print "********************"
else:
print "*********************"
print "Shutdown Unsuccessful"
print "*********************"
17 changes: 17 additions & 0 deletions python-scripts/startup
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/python
## Build script
## inst_i denotes ith instruction
## if inst_i==0 than instruction is successful else not

# Apache Server Start
import os
inst_1=os.system("service apache2 start")

if(inst_1==0):
print "****************"
print "Start Successful"
print "****************"
else:
print "******************"
print "Start Unsuccessful"
print "******************"

0 comments on commit c654280

Please sign in to comment.