User talk:Rsepp: Difference between revisions

From ICO wiki
Jump to navigationJump to search
Rsepp (talk | contribs)
Created page with '<source lang="bash"> #!/bin/bash #Autor: Rene Sepp A21 #Skript kontrollib, kas Ubuntu serveris on seadistatud etteantud IP alias IP=$1 #Õiguste kontroll if [ $UID -ne 0 ]; the…'
 
Mernits (talk | contribs)
No edit summary
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<source lang="bash">
PowerShelli skripti osas: Hää oleks teha nii, et kui wifi-adapter on disabled, siis muudab enable'ks ja vastupidi ka.
#!/bin/bash
#Autor: Rene Sepp A21
#Skript kontrollib, kas Ubuntu serveris on seadistatud etteantud IP alias


IP=$1
Terv,
 
Heiki
#Õiguste kontroll
if [ $UID -ne 0 ]; then
echo "Käivita skript $(basename $0) rootkasutaja õigustega"
exit 1
fi
#Kontroll kas IP on parameetrina antud
if [ $# -ne 1 ]; then
        echo "Käivita skript $(basename $0) koos IPga"
        exit 1
fi
 
#Otsib failist '/etc/network/interfaces' argumendis antud IP vastet ja võrdleb seda argumendis antud IP-ga
if [ $IP = $(grep $IP '/etc/network/interfaces' | cut -d"s" -f3 | cut -d" " -f2  | sort -u) ]; then
        echo "alias olemas"
        exit 0
else
        echo "aliast pole"
        exit 1
fi

Latest revision as of 09:34, 27 May 2011

PowerShelli skripti osas: Hää oleks teha nii, et kui wifi-adapter on disabled, siis muudab enable'ks ja vastupidi ka.

Terv, Heiki