我有一个conf文件产品,可以在启动时启动产品应用程序。
应用程序文件夹结构:
toPointToView: UIView
product.conf文件:
home/
jamnes/
product/
run.sh
如果用户升级应用程序,我们将放置新版本的不同结构
# Product start file
#
# Starts the Product App and respawns when it quits
description " Product Application"
start on desktop-session-start
stop on runlevel [!2345]
respawn
exec /home/james/product/run.sh
问题:
如何从product.conf文件中指向新版本产品
exec / home / james / new /product/run.sh
答案 0 :(得分:0)
我会在`/ home / jamnes / product'中使用符号链接import random as r
class Organism(object):
def __init__(self, genes,ID):
self.genes = genes
self.position = [0,0]
self.thisTime=str()
self.geneTranslation = []
self.ID=ID
def move(self,d):
if d == "f" or d == "forward":
self.position[1] += 1
elif d == "b" or d == "back":
self.position[1] -= 1
elif d == "r" or d == "right":
self.position[0] += 1
elif d == "l" or d == "left":
self.position[0] -= 1
print(self.position)
def isInContactWith(self,point):
point = list(point)
if self.position == point:
return True
else:
return False
def run(self):
for i in range(0,4):
if i == 0:
self.geneTranslation.extend(["f"] * self.genes[0])
elif i == 1:
self.geneTranslation.extend(["b"] * self.genes[1])
elif i == 2:
self.geneTranslation.extend(["r"] * self.genes[2])
elif i == 3:
self.geneTranslation.extend(["l"] * self.genes[3])
r.shuffle(self.geneTranslation)
for x in range(1,20):
try:
self.thisTime = r.choice(self.geneTranslation)
self.move(self.thisTime)
except:
pass
population = []
yValues={}
running = True
BestOrganism=Organism([25,25,25,25],0)
for count in range(50):
for x in range(100):
a = lambda: r.randint(-3, 3)
b = BestOrganism.genes[:]
anOrganism = Organism(b[:],x)
for count in range(len(anOrganism.genes[:])):
anOrganism.genes[count] += int(a())
population.append(anOrganism)
for j in range(len(population)):
print("Organism " + str(population[j].ID) + str(population[j].genes))
population[j].run()
yValues[population[j].ID]=population[j].position[1]
if population[j].position[1]>=20:
print(population[j].genes)
running = False
break
BestOrganism=max(yValues)
for k in range(len(population[:])):
if population[k].ID==BestOrganism:
BestOrganism=population[k]
print(yValues[max(yValues)])
print(BestOrganism.genes[:])
population=[]
yValues={}
。指向当前版本的产品。但是你的问题根本与upstart或ubuntu无关。