在Dockerfile中这么写:1
2
3
4
5
6
7FROM face_pytorch:latest
WORKDIR /face_version1
EXPOSE 5015
CMD ["sh","auto.sh"]
在auto.sh中设置多个要执行的命令,如启动redis、运行程序、定期保存文件1
2
3
4
5
6
7
8
9
10
11
12
13
14
15nohup ./redis-5.0.5/src/redis-server > myredis.txt 2>&1 &
echo "nohup redis-server complete!"
nohup python palm_re_v3.py > mypalmpy.txt 2>&1 &
echo "nohup python palm_re_v3.py complete!"
thetime=$(date "+%H%M") # the time is UTC0 not UTC8
while true
do
thetime=$(date "+%M")
if [ $thetime = '00' ]
then
echo "save pics every hour"
python save_palm_pics.py
fi
done