相关疑难解决方法(0)

在多个平台上找到正确的 tmp 目录

I have a script that needs to create temporary files for its work, and clean up after itself. My question is about finding the right base directory for the temporary files.

The script needs to work on multiple platforms: Git Bash (Windows), Solaris, Linux, OSX. On each platform, the preferred temp directory is expressed differently:

  • Windows: %TMP% (and possibly %TEMP%)
  • OSX: $TMPDIR
  • Linux, UNIX: supposed to be $TMPDIR but appears to be unset on multiple systems I tried

So …

directory shell-script tmp

57
推荐指数
3
解决办法
3万
查看次数

将 /tmp 移动到 RAM

我正在尝试转向/tmpRAM 并遵守良好做法:

  • /var/tmp不应放置在 中tmpfs,因为它必须在重新启动后存活

  • 不是/tmp作为独立安装tmpfs,而是依赖/dev/shm/run/shm

然而,事情在 2.6 和 3.2 内核之间发生了变化:

更改 tmpfs 文件系统的配置和默认值

在 3.2 内核上,RAMTMP=yes/etc/default/tmpfs.

我的问题是:如何使用旧内核实现这一目标?

我的选择不是修改 /etc/fstab 也不是:

mkdir /dev/shm/tmp
chmod 1777 /dev/shm/tmp
mount --bind /dev/shm/tmp /tmp
Run Code Online (Sandbox Code Playgroud)

RAMTMP2.6 内核有类似的东西吗?

mount tmpfs ram

28
推荐指数
3
解决办法
4万
查看次数

标签 统计

directory ×1

mount ×1

ram ×1

shell-script ×1

tmp ×1

tmpfs ×1