Elément de démarrage non sécurisé.

chaps31chaps31 Membre
octobre 2009 modifié dans API AppKit #1
Bonjour à  tous,

Dans le cadre d'un projet d'appli j'ai installé postgresql, ce qui entre autre installe un script pour lancer le serveur dans les startupItems.
Et là  problème insoluble.

A chaque fois que je démarre j'ai un message "Elément de démarrage non sécurisé désactivé", le script n'est pas lancé et le serveur non plus du coup... Pire si je lance le terminal et exécute le script à  partir du terminal, là  ça fonctionne !!!! Incompréhensible...

EDIT : Pour que cela fonctionne à  partir du terminal il me faut un sudo. J'ai réparé les autorisation sans succès

Quelqu'un a une idée ? Merci.

Réponses

  • yoannyoann Membre
    22:36 modifié #2
    Le script de lancement se trouve dans /Library/StartupItems ou /Library/LaunchDaemons ?

    C'est le second qui doit être utilisé, fait voir aussi le contenue du fichier voir comment il est fait
  • chaps31chaps31 Membre
    22:36 modifié #3
    Dans Library/startupItems, installé par le mpkg de postgresql

    #!/bin/sh<br /><br />. /etc/rc.common<br /><br />##<br /># Start up the PostgreSQL database server on Mac OS X / Darwin<br />#<br />#<br /># History<br /># -------<br />#<br /># 2009-02-27&nbsp; Andy Satori &lt;dru@druware.com&gt;<br />#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  Altered to support reading DATA, LOG and AUTOSTART from a plist<br />#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  to support the preference panel options<br />#<br /># 2009-01-06&nbsp; Andy Satori &lt;dru@druware.com&gt;<br />#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  Added a &#39;RELOAD&#39; option to the Restart call to allow a forced<br />#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  reload of the pg_hba.conf and postgresql.conf files<br />#<br /># 2008-11-06&nbsp; Andy Satori &lt;dru@druware.com&gt;<br />#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  Refactored DATA_PATH and LOG_FILE our to variables to make them<br />#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  easier to maintain and adjust from the GUI Preference Pane and <br />#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  associated tools.<br />#<br /># 2007-04-02&nbsp; Andy Satori &lt;dru@druware.com&gt;<br />#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  Added manual-restart manual-start options for use with the <br />#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  startup manager and allow the user to use hostconfig properly.<br />#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  (probably last change before moving to launchd for leopard)<br />#<br /># 2005-02-28&nbsp; Andy Satori &lt;dru@druwaer.com &gt;<br />#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  Modified to resolve issues with the Postgres user not having a<br />#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  Shell defined (su -m)<br />#<br /># 2005-02-07&nbsp; Andy Satori &lt;dru@druware.com&gt;<br />#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  Updated for the new PostgreSQL8 package from Druware<br />#			&nbsp; Software Designs<br />#<br /># 2004-03-09&nbsp; Andy Satori &lt;dru@druware.com&gt;<br />#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  Modified to use the /Library/PostgreSQL/Data path<br />#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  and place logs in /Library/Logs/PostgreSQL.log for<br />#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  use with the /Applications/Utilities/Console.app<br />#<br /># 2002-08-21&nbsp; Marc Liyanage &lt;liyanage@access.ch&gt;<br />#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  Changed startup to use pg_ctl<br />#<br /># 2002-08-19&nbsp; Ed Silva &lt;ed@septicus.com&gt;<br />#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  Modified startup script to conform<br />#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  to new SystemStarter format for Mac OS X 10.2<br />#<br /># 2001-04-02&nbsp; Marc Liyanage &lt;liyanage@access.ch&gt;<br />#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  First version<br />#<br /># 2001-12-02&nbsp; Johan Henselmans &lt;johanhenselmans@mac.com&gt;<br />#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  Enhanced after carefully studying the Frontbase<br />#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  startup sequence ;-)<br />#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  Now provides a stop procedure for a graceful shutdown<br />#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  and a hard kill if the clean shutdown doesn&#39;t work.<br />#<br /># 2001-12-02&nbsp; Marc Liyanage &lt;liyanage@access.ch&gt;<br />#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  Added localized startup messages in 7 languages<br />#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  by adapting the resources of the Apple-supplied<br />#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  &quot;Sendmail&quot; startup script.<br />#<br />#<br /># License<br /># -------<br />#<br /># The PostgreSQL BSD-style license applies to this file<br />#<br /><br />DATA_PATH=&quot;/Library/PostgreSQL8/data&quot;<br />LOG_FILE=&quot;/Library/PostgreSQL8/log/PostgreSQL8.log&quot;<br />AUTO_START=&quot;YES&quot;<br />MANUAL=&quot;NO&quot;<br />RELOAD=&quot;NO&quot;<br /><br /># if the preferences file exists, read it.<br />if test -f &quot;/Library/Preferences/com.druware.postgresqlformac.plist&quot;; then<br />	X=`defaults read /Library/Preferences/com.druware.postgresqlformac | grep dataPath`<br />	if [ &quot;$X&quot; != &quot;&quot; ]; then<br />		DATA_PATH=`defaults read /Library/Preferences/com.druware.postgresqlformac dataPath`<br />	fi<br />	<br />	X=`defaults read /Library/Preferences/com.druware.postgresqlformac | grep logPath`<br />	if [ &quot;$X&quot; != &quot;&quot; ]; then<br />		LOG_FILE=`defaults read /Library/Preferences/com.druware.postgresqlformac logPath`<br />	fi<br />	<br />	X=`defaults read /Library/Preferences/com.druware.postgresqlformac | grep startAtBoot`<br />	if [ &quot;$X&quot; != &quot;&quot; ]; then<br />		AUTO_START=`defaults read /Library/Preferences/com.druware.postgresqlformac startAtBoot`<br />	fi<br />	<br />	X=`defaults read /Library/Preferences/com.druware.postgresqlformac | grep manual`<br />	if [ &quot;$X&quot; != &quot;&quot; ]; then<br />		MANUAL=`defaults read /Library/Preferences/com.druware.postgresqlformac manual`<br />	fi<br /><br />	X=`defaults read /Library/Preferences/com.druware.postgresqlformac | grep reload`<br />	if [ &quot;$X&quot; != &quot;&quot; ]; then<br />		RELOAD=`defaults read /Library/Preferences/com.druware.postgresqlformac reload`<br />	fi	<br />fi<br /><br /># display the options in the log<br />ConsoleMessage &quot;PostgreSQL Data Path: $DATA_PATH&quot;<br />ConsoleMessage &quot;PostgreSQL Log Path: $LOG_FILE&quot;<br />ConsoleMessage &quot;PostgreSQL Auto Starts: $AUTO_START&quot;<br />ConsoleMessage &quot;PostgreSQL Manual: $MANUAL&quot;<br />ConsoleMessage &quot;PostgreSQL Reload: $RELOAD&quot;<br /><br />overrideEnvironment=&#39;-NO-&#39;<br />reloadOnRestart=&#39;-NO-&#39;<br /><br />if [ &quot;$MANUAL&quot; = &quot;YES&quot; ]; then<br />	overrideEnvironment=&#39;-YES-&#39;<br />fi<br />if [ &quot;$RELOAD&quot; = &quot;YES&quot; ]; then<br />	reloadOnRestart=&#39;-YES-&#39;<br />fi<br /><br /># on the off chance this gets called the old way, read the options from the <br /># command line<br />for f in &quot;$@&quot;<br />do<br />	if [ &quot;$f&quot; = &quot;MANUAL&quot; ]; then<br />		overrideEnvironment=&#39;-YES-&#39;<br />	fi<br />	if [ &quot;$f&quot; = &quot;RELOAD&quot; ]; then<br />		reloadOnRestart=&#39;-YES-&#39;<br />	fi<br />done<br /><br />StartService ()<br />{<br />	shouldStartPostgres=&quot;-NO-&quot;<br />	<br />	if [ &quot;${POSTGRES:=-YES-}&quot; = &quot;-YES-&quot; ]; then<br />		if [ &quot;$AUTO_START&quot; = &quot;YES&quot; ]; then<br />			shouldStartPostgres=&quot;-YES-&quot;<br />		fi<br />	fi<br />	<br />	if [ &quot;$overrideEnvironment&quot; = &quot;-YES-&quot; ]; then<br />		shouldStartPostgres=&quot;-YES-&quot;<br />	fi<br />		<br />	if [ &quot;$shouldStartPostgres&quot; = &quot;-YES-&quot; ]; then<br />	&nbsp; &nbsp; ConsoleMessage &quot;Starting PostgreSQL database server&quot;<br />	&nbsp; &nbsp; su -m postgres -c &quot;/Library/PostgreSQL8/bin/pg_ctl start -D $DATA_PATH -l $LOG_FILE -o -i&quot;<br />	fi<br /><br />}<br /><br />StopService()<br />{<br />	ConsoleMessage &quot;Stopping PostgreSQL database services&quot;<br />	su -m postgres -c &quot;/Library/PostgreSQL8/bin/pg_ctl stop -D $DATA_PATH&quot;<br />	<br />	sleep 1<br />	x=`ps auxwc | grep &#39;^postgres&#39; |grep &#39;postgres$&#39; | awk -F&quot; &quot; &#39;{print $2}&#39;`<br />	if /bin/test &quot;$x&quot;<br />	then<br />		set $x<br />		kill -9 $x<br />	fi<br /><br />}<br /><br />RestartService ()<br />{<br />	if [ &quot;$reloadOnRestart&quot; = &quot;-YES-&quot; ]; then<br />		ConsoleMessage &quot;Stopping PostgreSQL database services&quot;<br />		su -m postgres -c &quot;/Library/PostgreSQL8/bin/pg_ctl reload -D $DATA_PATH&quot;		<br />	else<br />		StopService<br />		sleep 1<br />		StartService<br />	fi<br />}<br /><br />RunService &quot;$1&quot;<br /><br />
    



    Merci
  • yoannyoann Membre
    22:36 modifié #4
    Tu devrais placer ce script ailleurs (genre /usr/local/bin) et faire un launchservices valable se servant de ce script à  lancer en root

    Pour les LaunchServices la doc est la : http://developer.apple.com/mac/library/documentation/Darwin/Reference/ManPages/man5/launchd.plist.5.html
  • chaps31chaps31 Membre
    22:36 modifié #5
    Oups voilà  un domaine que je ne connais pas, le soucis c'est que mon futur installeur devra lancer le package d'install de postgres qui place le fichier... Donc je préférerais l'utiliser in situ et résoudre cet embroglio d'autorisation..
Connectez-vous ou Inscrivez-vous pour répondre.