postgresql 如何在 /tmp 文件夹中创建永久符号链接以启动 postgres?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14432563/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to create permanent Symbolic link in /tmp folder to start postgres?
提问by iCyborg
I am running postgresql but with every system reboot, the symbolic link /tmp/.s.PGSQL.5432 gets deleted so I have to manually create it through
我正在运行 postgresql 但每次系统重新启动时,符号链接 /tmp/.s.PGSQL.5432 都会被删除,因此我必须通过手动创建它
sudo ln -s /tmp/.s.PGSQL.5432 /var/run/postgresql/.s.PGSQL.5432
and only then postgres start. Is there anyway I can automate this (say the command running at the time system starts) ? also why this /tmp link for postgres ? I am sure there is a better solution then to keep on creating the /tmp link after every reboot
然后只有 postgres 启动。无论如何我可以自动执行此操作(例如系统启动时运行的命令)?还有为什么这个 /tmp 链接用于 postgres ?我确信有一个更好的解决方案,然后在每次重新启动后继续创建 /tmp 链接
I am on ubuntu 12.10 btw
我在 ubuntu 12.10 顺便说一句
EDIT - the code do look in reverse order but it is working now, see https://askubuntu.com/a/213462too
编辑-代码做相反的顺序看,不过现在的工作,看到https://askubuntu.com/a/213462太
Thanks
谢谢
回答by NobleUplift
Add it to the startup script. You won't need sudo as all startup scripts are run as root. It should be located in /etc/init.d
, so you can edit it with sudo vim /etc/init.d/postgres
.
将其添加到启动脚本中。您不需要 sudo,因为所有启动脚本都以 root 身份运行。它应该位于 中/etc/init.d
,因此您可以使用 进行编辑sudo vim /etc/init.d/postgres
。