小编Mar*_*ark的帖子

EC2上的启动脚本

我创建了一个自定义Amazon AMI(Fedora)运行一些脚本然后关闭.

AMI的问题在于,如果我的代码发生了变化,那么AMI实例必须有一种方法可以在执行它们之前获取最新的脚本.

我写了一个shell脚本并将其放入 /etc/init.d/nt_startup

为了使代码保持最新,我git pull在代码库中执行shell脚本,然后执行脚本.

问题是,git pull实例启动时似乎没有运行,但python脚本运行得很好.不知道我错过了什么......这是启动脚本:

#!/bin/bash
#
# ec2 Startup script for EC2 machines
#
# chkconfig: 345 99 02
# description: Script used to issue startup and shutdown commands.
#

if [ "$1" = "start" ]; then
 /usr/scripts/code/git_latest
 python /usr/scripts/code/process.py
 exit
fi

if [ "$1" = "stop" ]; then
#nothing
exit
fi
Run Code Online (Sandbox Code Playgroud)

/usr/scripts/code/git_latestshell脚本是这样的:

#pulls in the latest code from the repository
cd /usr/scripts/code
sudo git pull
Run Code Online (Sandbox Code Playgroud)

它应该是拉下最新的process.py脚本. …

git shell fedora amazon-ec2

6
推荐指数
1
解决办法
5404
查看次数

Django日期过滤器按日期过滤

我需要编写一个查询,返回所有对象少于或等于特定月份的某一天.这一年并不重要.在特定的日/月(假设now = datetime.datetime.now())获取对象很容易:

posts = TodaysObject.objects.filter(publish_date__day=now.day, publish_date__month=now.month)
Run Code Online (Sandbox Code Playgroud)

但我不能这样做:

posts = TodaysObject.objects.filter(publish_date__day__lte=now.day, publish_date__month=now.month)
Run Code Online (Sandbox Code Playgroud)

似乎Django认为我在组合多个字段查找时尝试进行连接(publish_date__day__lte).在Django中最好的方法是什么?

python django

4
推荐指数
1
解决办法
7739
查看次数

标签 统计

amazon-ec2 ×1

django ×1

fedora ×1

git ×1

python ×1

shell ×1