Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Script bash all'avvio
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Forum italiano (Italian) Forum di discussione italiano
View previous topic :: View next topic  
Author Message
HoX
Guru
Guru


Joined: 11 Nov 2006
Posts: 385

PostPosted: Wed Feb 06, 2008 6:54 pm    Post subject: Script bash all'avvio Reply with quote

Ho scritto uno script di bash che tramite il parametro --loop va avanti all'infinito.
Ora avrei bisogno di inserirlo nel runlevel battery, ma non capisco come fare.

Ho provato a leggere sulla documentazione relativa agli initscript, ma parla solo di servizi e non di file bash... come faccio?
Back to top
View user's profile Send private message
cloc3
Advocate
Advocate


Joined: 13 Jan 2004
Posts: 4787
Location: http://www.gentoo-users.org/user/cloc3/

PostPosted: Wed Feb 06, 2008 7:31 pm    Post subject: Reply with quote

i servizi sono programmi generici.
possono essere scritti con qualunque linguaggio. anche bash.

se tu hai scritto il tuo programmino di bash, lo hai messo in /usr/local/bin/mioservizio e lo hai reso eseguibile, potrai attivarlo semplicemente usando la voce **mioservizio** come comando nell'initscript.
_________________
vu vu vu
gentù
mi piaci tu
Back to top
View user's profile Send private message
Luca89
Advocate
Advocate


Joined: 27 Apr 2005
Posts: 2107
Location: Agrigento (Italy)

PostPosted: Wed Feb 06, 2008 8:22 pm    Post subject: Reply with quote

Devi creare un file in /etc/init.d che gestisca l'avvio e lo stop del tuo servizio. Basta che dai una lettura agli altri servizi che ci sono e capirai la sintassi.
_________________
Running Fast!
Back to top
View user's profile Send private message
HoX
Guru
Guru


Joined: 11 Nov 2006
Posts: 385

PostPosted: Thu Feb 07, 2008 9:58 am    Post subject: Reply with quote

Ok... ho creato la voce battery in init.d... xo' quando do: /etc/init.d/battery start non succede nulla di nulla...

questo è il file:
/etc/init.d/battery:
start() {
        ebegin "Starting battery monitor"
        start-stop-daemon --start --exec /usr/local/bin/battery --make-pidfile /tmp/battery.pid-- -a=10 -w=always -d=120 &> /$
        eend 0
}

stop() {
        ebegin "Stopping battery monitor"
        start-stop-daemon --stop --exec /usr/local/bin/battery --pidfile /tmp/battery.pid
        eend 0
}


secondo voi xke' non funziona?
Back to top
View user's profile Send private message
cloc3
Advocate
Advocate


Joined: 13 Jan 2004
Posts: 4787
Location: http://www.gentoo-users.org/user/cloc3/

PostPosted: Thu Feb 07, 2008 1:25 pm    Post subject: Reply with quote

Anema wrote:

secondo voi xke' non funziona?

ho provato con questo eseguibile idiota:
Code:

wlan0 ~ # cat /usr/local/bin/battery
#!/bin/bash
a=3
echo $a
while [ $a != 2 ]; do
  date +%N >>/var/tmp/pippo;
  done

a me funziona.
_________________
vu vu vu
gentù
mi piaci tu
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Forum italiano (Italian) Forum di discussione italiano All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum