View previous topic :: View next topic |
Author |
Message |
mrfree Veteran


Joined: 15 Mar 2003 Posts: 1303 Location: Europe.Italy.Sulmona
|
Posted: Tue Apr 29, 2003 2:54 pm Post subject: Utile (forse) script per chi usa il portatile |
|
|
Consiglio a tutti quelli che come me hanno bisogno di switchare diverse configurazioni, presumibilmente su un portatile e principalmente in base al giorno della settimana ... questo semplice init script
Code: | #!/sbin/runscript
# Copyright 2003 Frittella Laurento - MrFree
# Distributed under the terms of the GNU General Public License v2
# Profilo utilizzato in ufficio (Giorni Feriali)
OFFICE="Ufficio"
# Profilo utilizzato a casa (Giorni Festivi)
HOME="Casa"
TODAY=$(date +%a)
depend() {
need net
need clock
}
start() {
ebegin "QuickSwitch of the Day ;) "
case "$TODAY" in
Mon | Tue | Wed | Thu | Fri )
switchto $OFFICE &> /dev/null
;;
Sat | Sun )
switchto $HOME &> /dev/null
;;
esac
eend 0
}
|
Visto che ne avevo bisogno subito mi sono limitato a questo, ma se vi interessa in seguito potrei postare la versione che considera orario di lavoro e giorni di festa o di ferie, ovviamente indicati in un file di configurazione.
Ahhhh... compagno quickswitch  _________________ Please EU, pimp my country!
ICE: /etc/init.d/iptables panic |
|
Back to top |
|
 |
cerri Bodhisattva


Joined: 05 Mar 2003 Posts: 2957 Location: # init S
|
Posted: Tue Apr 29, 2003 3:16 pm Post subject: |
|
|
? _________________ Enjoy your freedom.
Sex is like hacking. You get in, you get out, and you hope you didnt leave something behind that can be traced back to you.
<----------------------->
Andrea Cerrito |
|
Back to top |
|
 |
mrfree Veteran


Joined: 15 Mar 2003 Posts: 1303 Location: Europe.Italy.Sulmona
|
Posted: Tue Apr 29, 2003 3:24 pm Post subject: |
|
|
fa parte, in realtà è il cuore, dell'ebuild quickswitch mi pare se ne sia parlato qualche post fa riguardo a piccoli ma utilissimi software ... forse le storie con la tipa ti hanno distratto  _________________ Please EU, pimp my country!
ICE: /etc/init.d/iptables panic |
|
Back to top |
|
 |
cerri Bodhisattva


Joined: 05 Mar 2003 Posts: 2957 Location: # init S
|
Posted: Tue Apr 29, 2003 3:25 pm Post subject: |
|
|
...che le storie con la tipa mi abbiamo distratto si, ma che l'eseguibile switchto facesse parte di quickswitch (mai provato, mi basta dhcpcd ) non lo sapevo... come potevo!?!?!?  _________________ Enjoy your freedom.
Sex is like hacking. You get in, you get out, and you hope you didnt leave something behind that can be traced back to you.
<----------------------->
Andrea Cerrito |
|
Back to top |
|
 |
bsolar Bodhisattva


Joined: 12 Jan 2003 Posts: 2764
|
Posted: Tue Apr 29, 2003 4:08 pm Post subject: |
|
|
mrfree wrote: |
fa parte, in realtà è il cuore, dell'ebuild quickswitch mi pare se ne sia parlato qualche post fa riguardo a piccoli ma utilissimi software ... |
Parli di questo messaggio immagino...  _________________ I may not agree with what you say, but I'll defend to the death your right to say it. |
|
Back to top |
|
 |
cerri Bodhisattva


Joined: 05 Mar 2003 Posts: 2957 Location: # init S
|
Posted: Tue Apr 29, 2003 6:31 pm Post subject: |
|
|
Sicuramente... ma tra quickswitch e switchto ce ne corre...  _________________ Enjoy your freedom.
Sex is like hacking. You get in, you get out, and you hope you didnt leave something behind that can be traced back to you.
<----------------------->
Andrea Cerrito |
|
Back to top |
|
 |
Ginko Guru


Joined: 01 May 2002 Posts: 371 Location: nearby my linux laptop
|
Posted: Wed Apr 30, 2003 8:56 am Post subject: Re: Utile (forse) script per chi usa il portatile |
|
|
mrfree wrote: | Consiglio a tutti quelli che come me hanno bisogno di switchare diverse configurazioni, presumibilmente su un portatile e principalmente in base al giorno della settimana ... questo semplice init script [..] |
Io uso qualcosa di molto simile, in piu' pero', dovendo visitare diversi clienti e portandomi sempre il laptop appresso, ho la necessita' di scegliere il profile all'avvio.
E lo faccio mediante l'append in lilo.conf. Esempio : Code: | [..]
prompt
timeout=50
default=auto
image=/boot/gentoo-2.4.19-r9_new
label=auto
read-only
root=/dev/hda7
append="prof=auto"
image=/boot/gentoo-2.4.19-r9_new
label=customer1
read-only
root=/dev/hda7
append="prof=customer1"
image=/boot/gentoo-2.4.19-r9_new
label=customer2
read-only
root=/dev/hda7
append="prof=customer2"
image=/boot/gentoo-2.4.19-r9_new
label=casa
read-only
root=/dev/hda7
append="prof=casa"
|
Il profilo scelto me lo ritrovo poi in /proc/cmdline che posso leggere da uno
start-up script simile al tuo. In effetti il profilo auto fa esattamente quello che fai tu verificando che giorno e'
Saluti
--Gianluca |
|
Back to top |
|
 |
poisson n00b


Joined: 24 Nov 2002 Posts: 35
|
Posted: Fri May 02, 2003 10:52 pm Post subject: Re: Utile (forse) script per chi usa il portatile |
|
|
Gianluca Rotoni wrote: | Il profilo scelto me lo ritrovo poi in /proc/cmdline che posso leggere da uno
start-up script simile al tuo. In effetti il profilo auto fa esattamente quello che fai tu verificando che giorno e'
|
L'utilizzo dell'append e' ancora piu' semplice:
Code: | append="prof=blabla" | altro non fa che assegnare "blabla" alla variabile d'ambiente "prof", disponibile in tutti gli script di boot.
Ciao !! |
|
Back to top |
|
 |
maur8 Apprentice


Joined: 04 Mar 2003 Posts: 229 Location: Pescara (in serie B!!!), Italy
|
Posted: Sat May 03, 2003 5:05 pm Post subject: |
|
|
Mitico quickswitch e grande mrfree!
Saluti da Fabrizio  _________________ Maur8.
"They decided our fate in a microsecond. Extermination"
Sgt. Kyle Rise, The Terminator |
|
Back to top |
|
 |
|