Strona 2 z 2

: 12 lutego 2014, 12:07
autor: gambi
Mistrzowie, jednak to moja wina, skrypt działa.
Myślę, że przyczyną była próba uruchomienia jednocześnie dwóch różnych skryptów (dwóch serwerów) o czym wcześniej nie napisałem.
Tak zapisany rc.local działa:

Kod: Zaznacz cały

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
[B]/home/gambi/SERWERY/SERWER3/serwer1[/B]
exit 0
Jednak zależy mi na uruchomieniu jednocześnie dwóch skryptów i próbowałem tego :

Kod: Zaznacz cały

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
[B]/home/gambi/SERWERY/SERWER3/serwer1
/home/gambi/SERWERY/SERWER2/serwer2[/B]
exit 0
Ale jak pisałem w poprzednim poście raz się uruchamia a raz nie.
Jak zatem zapisać aby oba startowały z systemem?

: 12 lutego 2014, 13:48
autor: Van Pytel
Między poleceniem 1 a 2 daj sleep 10 (10 sekund).
A skrypty ze sobą nie kolidują się?

: 12 lutego 2014, 13:54
autor: gambi
Tak to ma wyglądać?

Kod: Zaznacz cały

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.[B]
/home/gambi/SERWERY/SERWER3/serwer1
sleep 10
/home/gambi/SERWERY/SERWER2/serwer2[/B]

exit 0

: 13 lutego 2014, 09:15
autor: Van Pytel
Tak.

: 14 lutego 2014, 14:50
autor: gambi
Teraz zadziałało :)
Dopisałem jeszcze w rc.local przed ścieżkami do skryptow komende su gambi

Kod: Zaznacz cały

su gambi /home/gambi/SERWERY/SERWER3/serwer1

sleep 10

su gambi /home/gambi/SERWERY/SERWER2/serwer2


aby skrypt uruchamial sie z prawami usera a nie jako root.
Pozdrawiam serdecznie i dziekuję za pomoc Mistrzowie.

: 14 lutego 2014, 21:16
autor: Van Pytel
Zawsze możesz zmienić ten czas (10) na taki jak chcesz.

: 17 lutego 2014, 02:50
autor: gambi
Van Pytel pisze:Zawsze możesz zmienić ten czas (10) na taki jak chcesz.
Tak też zrobiłem bo kilka razy drugi skrypt nie odpalił, a po zmianie na

Kod: Zaznacz cały

sleep 20
ruszają obydwa bez problemu.
Jeszcze raz dziękuję.

: 17 lutego 2014, 10:09
autor: Yampress
No ale system odpala się 20s dłużej...