Strona 1 z 1
Uruchamianie skryptu - z palca działa, z rc.local nie
: 06 września 2011, 13:46
autor: LordRuthwen
Witam.
Od czego może zależeć brak możliwości uruchomienia skryptu za pomocą dopisania go ro rc.local?
Uruchamiając poleceniem:
wszystko działa jak należy, ale jak to samo dopiszę do rc.local to już nie.
: 06 września 2011, 14:27
autor: v-sgfx
: 06 września 2011, 14:29
autor: LordRuthwen
Tak już też próbowałem, zapomniałem napisać.
: 06 września 2011, 14:48
autor: mariaczi
Sprawdź jakich poleceń używasz w skrypcie. Możliwe, że nie ma do nich ścieżek dostępu.
: 06 września 2011, 14:53
autor: v-sgfx
Może podaj ten skrypt w tagach
[noparse][/noparse][/b], jakieś dodatkowe informacje.
: 06 września 2011, 15:05
autor: LordRuthwen
Kod: Zaznacz cały
#!/bin/bash
# description: The InfocastServer transmits infocast data on multicast \
# channels.
# pidfile: /var/run/infocast.pid
#------------------------------------------------------------------------------
# infocastserverd {start|stop|restart|status}
#
# Controls the Infocast server
#------------------------------------------------------------------------------
success()
{
echo -ne "\\033[60G[ \\033[1;32mOK\\033[0;39m ]"
return 0;
}
failure()
{
echo -ne "\\033[60G[\\033[1;31mFAILED\\033[0;39m]"
return 1;
}
# Source configuration file
INSTALLDIR="/opt/kreatel-server"
# Variables
PIDFILE=/var/run/infocast.pid
LOGFILE="$INSTALLDIR"/infocast/infocast.log
JARFILE="$INSTALLDIR"/infocast/InfocastServer.jar
JAVA="$JAVA_HOME"/jre/bin/java
# A function to check if the server is running
running()
{
[ -f $PIDFILE ] && PID=`cat $PIDFILE` && [ -n "$PID" ] && ps -p $PID > /dev/null 2>&1
}
# A function to start the server
start()
{
echo -n "Starting InfocastServer:"
if running ; then
failure "InfocastServer startup"
else
"$JAVA" -Xmx128m -jar "$JARFILE" -v > "$LOGFILE" 2>&1 &
echo $! > $PIDFILE
running && success "InfocastServer startup" || failure "InfocastServer startup"
fi
RETVAL=$?
echo
}
# A function to stop the server
stop()
{
echo -n "Stopping InfocastServer:"
if running ; then
kill $PID
sleep 1
if running ; then
kill -9 $PID
sleep 1
fi
rm -f $PIDFILE
running && failure "InfocastServer shutdown" || success "InfocastServer shutdown"
else
failure "InfocastServer shutdown"
fi
RETVAL=$?
echo
}
# A function to check the server status
status()
{
if running ; then
echo "InfocastServer (pid $PID) is running..."
RETVAL=0
else
echo "InfocastServer is stopped"
RETVAL=1
fi
}
cd "$INSTALLDIR"/infocast
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
rm -f "$LOGFILE"
start
;;
status)
status
;;
*)
echo "Usage: infocastserverd {start|stop|restart|status}"
RETVAL=1
;;
esac
exit $RETVAL
: 07 września 2011, 10:27
autor: v-sgfx
Przykładowo u mnie na serwerze jest tak, tylko ja posiadam Slackware i umieszczam skrypty startowe jak wspomniałem w rc.local. I nie mam problemów.
Przykład:
Kod: Zaznacz cały
/usr/sbin/sshd -p 60022
proftpd
chmod 644 /proc/net/ipt_account/all
Mam nadzieję, że nie dodajesz tej linii włącznie ze "start". Ewentualnie spróbuj z
prawami dostępu do pliku.
spróbuj w rc.local.
: 07 września 2011, 22:11
autor: fnmirk
: 08 września 2011, 08:40
autor: markossx
Wrzuć go do /etc/init.d/ i spróbuj przez invoke-rc.d jak nie ćwiczyłeś tego jeszcze....