PostgreSQL rc.d script outputting fortunes: Difference between revisions
(Created page with '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. == T…') |
|||
Line 20: | Line 20: | ||
And now I don't get the any tips when using the postgresql rc.d script: | And now I don't get the any tips when using the postgresql rc.d script: | ||
<pre> | |||
[root@wackbox163 /usr/local/pgsql]# /usr/local/etc/rc.d/postgresql restart | [root@wackbox163 /usr/local/pgsql]# /usr/local/etc/rc.d/postgresql restart | ||
server stopped | server stopped | ||
[root@wackbox163 /usr/local/pgsql]# | [root@wackbox163 /usr/local/pgsql]# | ||
</pre> | |||
== 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. |
Revision as of 09:22, 20 December 2009
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.