Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clean up temp dir/files for some operation like upload_project #4

Closed
huanghao opened this issue May 10, 2012 · 4 comments
Closed

clean up temp dir/files for some operation like upload_project #4

huanghao opened this issue May 10, 2012 · 4 comments

Comments

@huanghao
Copy link
Owner

ltmp 和 tmp中有很多临时文件。需要清理。
也许可以使用两种方式,一种是用完就删除,另一种是定期删除。
如果确定是临时文件,也没有后续查询排错的需要,就地删除。
如果是定期删除,需要有特定的规则能够区分这些临时文件。(目录名/文件名)
定期是按时间,还是检查大小。。。

@ghost
Copy link

ghost commented May 10, 2012

临时文件用完删除就可以,没必要多保存一份。
在部署出错的时候应该也能够自动清理tmp/ltmp下生成的临时文件。

@huanghao
Copy link
Owner Author

upload_project上传到remote得临时目录已经清除。
cateester had fix it。

剩下还有一些其他操作会产生临时文件,如svn export到本地的目录

@huanghao
Copy link
Owner Author

有个小bug,那行rm不能直接加在后面,如果推送的机器包含localhost,
workcopy的目录和upload以后的目录名字一样,如果删除掉了,workcopy也就没有
后面一台推送的时候就会报错找不到workcopy。

1)upload_project在源和目标都是同一台机器的同一个目录时,没有报错,估计做判断了,要看一下源码
2)需要把workcopy和目标的名字弄成不一样,而且是临时性的,就可以删除了

relink_current_rel('releases/%s' % pid)
sudo('rm -rf %s' % os.path.join(myenv.tmp, pid))

@huanghao
Copy link
Owner Author

done!

local temp file:
add a function "unlink" to remove them at program exit

remote temp file:
add try/finally block to remove remote temp file when it is useless

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant