[+] Uruchamianie skryptu po starcie systemu

Konfiguracja serwerów, usług, itp.
gambi
Posty: 56
Rejestracja: 10 lutego 2014, 12:41

Post 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?
Van Pytel
Beginner
Posty: 166
Rejestracja: 09 maja 2010, 17:05

Post autor: Van Pytel »

Między poleceniem 1 a 2 daj sleep 10 (10 sekund).
A skrypty ze sobą nie kolidują się?
gambi
Posty: 56
Rejestracja: 10 lutego 2014, 12:41

Post 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
Van Pytel
Beginner
Posty: 166
Rejestracja: 09 maja 2010, 17:05

Post autor: Van Pytel »

Tak.
gambi
Posty: 56
Rejestracja: 10 lutego 2014, 12:41

Post 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.
Van Pytel
Beginner
Posty: 166
Rejestracja: 09 maja 2010, 17:05

Post autor: Van Pytel »

Zawsze możesz zmienić ten czas (10) na taki jak chcesz.
gambi
Posty: 56
Rejestracja: 10 lutego 2014, 12:41

Post 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ę.
Awatar użytkownika
Yampress
Administrator
Posty: 6422
Rejestracja: 09 sierpnia 2007, 21:41
Lokalizacja: PL

Post autor: Yampress »

No ale system odpala się 20s dłużej...
ODPOWIEDZ