PostgreSQL rc.d script outputting fortunes: Difference between revisions
No edit summary |
No edit summary |
||
(One intermediate revision by the same user not shown) | |||
Line 28: | Line 28: | ||
== Explanation == | == Explanation == | ||
This happens because the postgresql rc.d script switches user to the postgresql ''pgsql'' user before executing the actual start/stop commands. For some reason, and only on this specific machine, the user switch with su called ''.profile'' which in turn ran the fortune system. | This happens because the postgresql rc.d script switches user to the postgresql ''pgsql'' user before executing the actual start/stop commands. For some reason, and only on this specific machine, the user switch with su called ''.profile'' which in turn ran the fortune system. The reason is probably that I always install "minimal" (in sysinstall) FreeBSD machines these days. The machine that had this problem is older and was installed as "standard" (in sysinstall). This means that /usr/games/fortune/ exists on this machine and not on a lot of my newer machines. The fortune line from .profile will only run if the fortunes are installed, of course. |
Latest revision as of 11:45, 3 January 2010
I've been having a weird problem with the postgresql rc.d script in a FreeBSD jail. I finally figured out today how to fix it and wanted to put it on here so I dont forget.
The problem
Whenever I call the postgresql rc.d script to start/stop/restart/whatever the postgres server I would get a fortune from freebsd-tips like when you log in:
[root@wackbox163 /usr/local/pgsql]# /usr/local/etc/rc.d/postgresql restart Any user that is a member of the wheel group can use "su -" to simulate a root login. You can add a user to the wheel group by editing /etc/group. -- Konstantinos Konstantinidis <kkonstan@duth.gr> server stopped [root@wackbox163 /usr/local/pgsql]#
The solution
I have been completely unable to figure out why this was happening, until a friend of mine reminded me to check .profile. I opened up /usr/local/pgsql/.profile and commented out the following line:
[ -x /usr/games/fortune ] && /usr/games/fortune freebsd-tips
And now I don't get the any tips when using the postgresql rc.d script:
[root@wackbox163 /usr/local/pgsql]# /usr/local/etc/rc.d/postgresql restart server stopped [root@wackbox163 /usr/local/pgsql]#
Explanation
This happens because the postgresql rc.d script switches user to the postgresql pgsql user before executing the actual start/stop commands. For some reason, and only on this specific machine, the user switch with su called .profile which in turn ran the fortune system. The reason is probably that I always install "minimal" (in sysinstall) FreeBSD machines these days. The machine that had this problem is older and was installed as "standard" (in sysinstall). This means that /usr/games/fortune/ exists on this machine and not on a lot of my newer machines. The fortune line from .profile will only run if the fortunes are installed, of course.