<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<atom:link href="http://forum.ubuntu-fr.org/extern.php?action=feed&amp;tid=1185261&amp;type=rss" rel="self" type="application/rss+xml" />
		<title><![CDATA[Forum Ubuntu-fr.org / script init.d : lancement manuel OK, lancement automatique -> erreur]]></title>
		<link>http://forum.ubuntu-fr.org/viewtopic.php?id=1185261</link>
		<description><![CDATA[Les sujets les plus récents dans script init.d : lancement manuel OK, lancement automatique -> erreur.]]></description>
		<lastBuildDate>Mon, 04 Feb 2013 11:29:50 +0000</lastBuildDate>
		<generator>FluxBB</generator>
		<item>
			<title><![CDATA[Réponse à&#160;:  script init.d : lancement manuel OK, lancement automatique -> erreur]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=12460191#p12460191</link>
			<description><![CDATA[<p>j&#039;ai dit une connerie ce serait plus :</p><div class="codebox"><pre><code># mkrssh-my script description
#

# Make sure we start after network is running
start on (started network-interface
          or started network-manager
          or started networking)

stop on runlevel [023456]</code></pre></div><p>un ubuntero pourrait me dire si cela fonctionne , au cas ou ?</p>]]></description>
			<author><![CDATA[dummy@example.com (sogyam)]]></author>
			<pubDate>Mon, 04 Feb 2013 11:29:50 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=12460191#p12460191</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  script init.d : lancement manuel OK, lancement automatique -> erreur]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=12412701#p12412701</link>
			<description><![CDATA[<p>si tu es sous ubuntu, c&#039;est upstart qui gère , regarde le man d&#039;upstart et fait un fichier /etc/init/mkrssh.conf du type :</p><div class="codebox"><pre><code># mkrssh-my script description
#

# Make sure we start after network is running
start on (running network-interface
          or running network-manager
          or running networking)

stop on runlevel [!023456]</code></pre></div><p>enfin essaye d&#039;adapter ..., je peux pas tester j&#039;ai n&#039;ai pas upstart , juste des vieux souvenirs !!</p><p>reedit : fais gaffe à la dernière ligne si tu veux l&#039;arrêter ...</p>]]></description>
			<author><![CDATA[dummy@example.com (sogyam)]]></author>
			<pubDate>Thu, 31 Jan 2013 18:00:32 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=12412701#p12412701</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  script init.d : lancement manuel OK, lancement automatique -> erreur]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=12411871#p12411871</link>
			<description><![CDATA[<div class="quotebox"><cite>nesthib a écrit&#160;:</cite><blockquote><div><p>Es-tu sûr que ta connexion réseau est fonctionnelle au moment où est lancé le script ?</p></div></blockquote></div><p>Absolument pas. Et je n&#039;ai aucune connaissance du processus de mise en état des cartes réseaux ; alors je ne sais même pas comment vérifier.</p><div class="quotebox"><cite>nesthib a écrit&#160;:</cite><blockquote><div><p>Je te propose une méthode alternative pour la mise en place d&#039;un tel tunnel :[...]</p></div></blockquote></div><p>Les choses simples sont souvent les meilleures ; mais ici je trouve ça un peu brouillon <img src="http://forum.ubuntu-fr.org/img/smilies/tongue.png" width="15" height="15" alt="tongue" />. Mais effectivement, je vais me rabattre dessus si j&#039;ai pas d&#039;idée avant la fin de la semaine. Merci à toi.</p>]]></description>
			<author><![CDATA[dummy@example.com (tmp6235)]]></author>
			<pubDate>Thu, 31 Jan 2013 16:57:43 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=12411871#p12411871</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  script init.d : lancement manuel OK, lancement automatique -> erreur]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=12411671#p12411671</link>
			<description><![CDATA[<p>Es-tu sûr que ta connexion réseau est fonctionnelle au moment où est lancé le script ?</p><p>Je te propose une méthode alternative pour la mise en place d&#039;un tel tunnel :</p><div class="codebox"><pre><code>#!/bin/bash

if ps -ef | egrep &#039;[s]sh -R.*Mario@ThisCastle&#039;
then
    echo &quot;ok&quot;
else
    nohup ssh -R… Mario@ThisCastle &amp;
fi</code></pre></div><p>À mettre par exemple en cron toutes les 10 min.</p><p>Le script va vérifier si le tunnel est en place, et si ce n&#039;est pas le cas le démarrer.</p>]]></description>
			<author><![CDATA[dummy@example.com (nesthib)]]></author>
			<pubDate>Thu, 31 Jan 2013 16:43:27 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=12411671#p12411671</guid>
		</item>
		<item>
			<title><![CDATA[script init.d : lancement manuel OK, lancement automatique -> erreur]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=12411551#p12411551</link>
			<description><![CDATA[<p>Bonjour à tous,</p><p>sur mon système, on trouve le fichier /etc/init.d/mkrssh construit sur la base de /etc/init.d/skeleton fourni avec notre distribution préférée (vous trouverez le code au bas de ce message). Les liens symboliques ont été créés dans les dossiers /etc/rc*.d/ avec la commande &lt;sudo update-rc mkrssh defaults&gt;.</p><p>Si je démarre manuellement mon daemon &lt;sudo service mkrssh start&gt; tout se passe comme prévu, le tunnel ssh est créé et tout comme il faut. En revanche, au démarrage de ma machine (AnOtherCastel), <em>le script est bien exécuté mais la création du tunnel échoue</em>. Pour preuve, le contenu du dossier log :</p><div class="codebox"><pre><code>Peach@AnOtherCastel:~$ cat /var/log/mkrssh
[2013-01-31 17:14:15]Test daemon start-up command...	[OK]
[2013-01-31 17:14:15]Start daemon...
[2013-01-31 17:15:40]Test daemon start-up command...	[OK]
[2013-01-31 17:15:40]Start daemon...			[OK]</code></pre></div><p>On voit que la tentative automatique à 17h14 a échoué (pas de [OK] à la seconde ligne) ; en revanche la tentative manuelle à 17h15 a réussi.</p><br /><br /><p>Avez-vous une piste quant à la résolution de mon problème ? D&#039;autre tests à effectuer ?<br />Bien cordialement,<br />Mario &amp; Peach</p><br /><br /><br /><br /><p>P.S. : le script mkrssh</p><div class="codebox"><pre class="vscroll"><code>Peach@AnOtherCastel:~$ cat /etc/init.d/mkrssh
#! /bin/sh
### BEGIN INIT INFO
# Provides:          mkrssh
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Create an ssh reverse tunnel from Mario@ThisCastel on port 12345
### END INIT INFO

# Author: Mario &amp; Peach

# PATH should only include /usr/* if it runs after the mountnfs.sh script
PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC=&quot;ssh reverse tunnel from Mario@ThisCastel on port 12345&quot;
NAME=mkrssh
DAEMON=/usr/bin/ssh
DAEMON_ARGS=&quot;-i /root/.ssh/id_rsa -R 12345:localhost:22 Mario@ThisCastel -fN&quot;
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME
LOG=/var/log/$NAME

# Exit if the package is not installed
[ -x &quot;$DAEMON&quot; ] || exit 0

# Read configuration variable file if it is present
[ -r /etc/default/$NAME ] &amp;&amp; . /etc/default/$NAME

# Load the VERBOSE setting and other rcS variables
. /lib/init/vars.sh

# Define LSB log_* functions.
# Depend on lsb-base (&gt;= 3.2-14) to ensure that this file is present
# and status_of_proc is working.
. /lib/lsb/init-functions

#
# Function that starts the daemon/service
#
do_start()
{
	# Return
	#   0 if daemon has been started
	#   1 if daemon was already running
	#   2 if daemon could not be started
	echo &quot;&quot; &gt;&gt; $LOG
	echo -n &quot;[`date +&#039;%F %T&#039;`]Test daemon start-up command...&quot; &gt;&gt; $LOG
	start-stop-daemon --start --quiet --pidfile $PIDFILE --make-pidfile --exec $DAEMON --test &gt; /dev/null \
		|| return 1
	echo &quot;\t[OK]&quot; &gt;&gt; $LOG
	echo -n &quot;[`date +&#039;%F %T&#039;`]Start daemon...&quot; &gt;&gt; $LOG
	start-stop-daemon --start --quiet --pidfile $PIDFILE --make-pidfile --exec $DAEMON -- \
		$DAEMON_ARGS \
		|| return 2
	echo &quot;\t\t\t[OK]&quot; &gt;&gt; $LOG
	# Add code here, if necessary, that waits for the process to be ready
	# to handle requests from services started subsequently which depend
	# on this one.  As a last resort, sleep for some time.
}

#
# Function that stops the daemon/service
#
do_stop()
{
	# Return
	#   0 if daemon has been stopped
	#   1 if daemon was already stopped
	#   2 if daemon could not be stopped
	#   other if a failure occurred
	start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
	RETVAL=&quot;$?&quot;
	[ &quot;$RETVAL&quot; = 2 ] &amp;&amp; return 2
	# Wait for children to finish too if this is a daemon that forks
	# and if the daemon is only ever run from this initscript.
	# If the above conditions are not satisfied then add some other code
	# that waits for the process to drop all resources that could be
	# needed by services started subsequently.  A last resort is to
	# sleep for some time.
	start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON
	[ &quot;$?&quot; = 2 ] &amp;&amp; return 2
	# Many daemons don&#039;t delete their pidfiles when they exit.
	rm -f $PIDFILE
	return &quot;$RETVAL&quot;
}

#
# Function that sends a SIGHUP to the daemon/service
#
do_reload() {
	#
	# If the daemon can reload its configuration without
	# restarting (for example, when it is sent a SIGHUP),
	# then implement that here.
	#
	start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME
	return 0
}

case &quot;$1&quot; in
  start)
	[ &quot;$VERBOSE&quot; != no ] &amp;&amp; log_daemon_msg &quot;Starting $DESC&quot; &quot;$NAME&quot;
	do_start
	case &quot;$?&quot; in
		0|1) [ &quot;$VERBOSE&quot; != no ] &amp;&amp; log_end_msg 0 ;;
		2) [ &quot;$VERBOSE&quot; != no ] &amp;&amp; log_end_msg 1 ;;
	esac
	;;
  stop)
	[ &quot;$VERBOSE&quot; != no ] &amp;&amp; log_daemon_msg &quot;Stopping $DESC&quot; &quot;$NAME&quot;
	do_stop
	case &quot;$?&quot; in
		0|1) [ &quot;$VERBOSE&quot; != no ] &amp;&amp; log_end_msg 0 ;;
		2) [ &quot;$VERBOSE&quot; != no ] &amp;&amp; log_end_msg 1 ;;
	esac
	;;
  status)
       status_of_proc &quot;$DAEMON&quot; &quot;$NAME&quot; &amp;&amp; exit 0 || exit $?
       ;;
  #reload|force-reload)
	#
	# If do_reload() is not implemented then leave this commented out
	# and leave &#039;force-reload&#039; as an alias for &#039;restart&#039;.
	#
	#log_daemon_msg &quot;Reloading $DESC&quot; &quot;$NAME&quot;
	#do_reload
	#log_end_msg $?
	#;;
  restart|force-reload)
	#
	# If the &quot;reload&quot; option is implemented then remove the
	# &#039;force-reload&#039; alias
	#
	log_daemon_msg &quot;Restarting $DESC&quot; &quot;$NAME&quot;
	do_stop
	case &quot;$?&quot; in
	  0|1)
		do_start
		case &quot;$?&quot; in
			0) log_end_msg 0 ;;
			1) log_end_msg 1 ;; # Old process is still running
			*) log_end_msg 1 ;; # Failed to start
		esac
		;;
	  *)
	  	# Failed to stop
		log_end_msg 1
		;;
	esac
	;;
  *)
	#echo &quot;Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}&quot; &gt;&amp;2
	echo &quot;Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}&quot; &gt;&amp;2
	exit 3
	;;
esac</code></pre></div>]]></description>
			<author><![CDATA[dummy@example.com (tmp6235)]]></author>
			<pubDate>Thu, 31 Jan 2013 16:36:50 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=12411551#p12411551</guid>
		</item>
	</channel>
</rss>
