[英]How to retrieve files from cloud foundry?
我目前有一個 Spring Boot Web 應用程序。 每次刷新 Web 應用程序時,應用程序都會寫入文件。 在本地我可以看到根路徑目錄中的文件。 但是,當我將 .jar 文件上傳到 cloud Foundry 時,我將如何獲取正在寫入的那些文件?
寫入文件的腳本片段
try{
Date date = new Date();
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH-mm-ss");
File file = new File(dateFormat.format(date) + "data.txt");
BufferedWriter out = new BufferedWriter(new FileWriter(file));
out.write("Some Data is being written");
out.close;
}
我可以在我的根文件夾中找到 data.txt。 但是在將應用程序打包到 jar 並將其推送到雲代工廠后,如何獲取這些文件。
CF推送命令
-cf push testapp -p target/webapp.jar
嘗試這個:
cf ssh-code
然后:
scp -P 2222 -o User=cf:<APP_GUID>/0 ssh.<system domain>:/<path>/<file name> <LOCAL_FILE_SYS>
謝謝,
昌丹
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.