【发布时间】:2016-04-14 18:56:34
【问题描述】:
我正在尝试使用 python subprocess.popen 命令挂载 nas 文件系统,我正在运行一个脚本来挂载文件系统。一些脚本无法挂载文件系统的原因。
我的脚本:
self.mountSrc = subprocess.Popen('mount'+' '+ self.src_m[l], shell=True)
print self.mountSrc
if self.mountSrc==0:
print "Mounted filesystem:"+ self.src_m[l]
我的脚本的输出:
Mounting: Source Mount Point:/rsyncTesting/source/share1
Starting:[................................................... ] Done!
mount: can't find /rsyncTesting/source/share1 in /etc/fstab or /etc/mtab
1
在运行 mount 命令之前,我正在更新 /etc/fstab 中的文件系统路径。我还可以从命令行以 root 用户身份手动挂载文件系统。
slcnas888:/export/rsyncScriptProject_Source/rsyncShare1/.zfs/snapshot/SR_0000-0000000_Refresh_rsyncShares_RSYNC_PROJ_exp13April16 /rsyncTesting/source/share1
【问题讨论】:
-
能否请您添加您将从终端使用的命令行?鉴于代码仅处理变量,并且显示的某些输出与代码 sn-p 无关,这将帮助您获得一个可以适应的解决方案
-
mount: can't find /rsyncTesting/source/share1 in /etc/fstab- 它确实说明了一切...... -
从 linux 命令行,我正在运行命令:“mount /rsyncTesting/source/share1”,这可以手动正常工作。我在 /etc/fstab 文件中添加文件系统条目,它工作正常,但使用 python 子进程失败。
标签: python linux subprocess popen