Fórum Ubuntu CZ/SK
		Ubuntu pro osobní počítače => Software => Příkazový řádek a programování pro GNU/Linux => Téma založeno: dexter_cz  03 Června 2008, 15:49:33
		
			
			- 
				Stahnul jsem si script na automaticky zamykani pc kdyz neni v dosahu muj telefon (funkcni pres bluetooth)
tady je ten script:
#!/bin/bash
#
# Written by Pieter de Rijk (pieter@de-rijk.com)
#
# Version 0.1
#
# License GPL 2.0
# 
# This script checks using hcitool scan for a bluetooth
# device you have defined in AUTHMAC. If it cannot find
# this device, the computer will be locked using xlock.
#The mac-addres of the bluetoothdevice
AUTHMAC="NO-MAC-DEFINED"
if [ $AUTHMAC == "NO-MAC-DEFINED" ]; then
	echo "PLEASE FILL IN THE MAC ADDRES OF YOUR BLUETOOTH DEVICE, IE YOUR PDA/MOBILE"
	exit 
fi
while [ true == true ];
do
	#Check if the bluetooth device of the computer is available, to
        #avoid unwanted locks.
	LOCAL_DEVICE_AVAILABLE=`hcitool device | grep -c hci`
	if [ $LOCAL_DEVICE_AVAILABLE != "0" ]; then
		#Scan for the authorised bluetooth device
		SEARCH_FOR_DEVICE=`hcitool scan | grep -c $AUTHMAC`
		if [ $SEARCH_FOR_DEVICE != "1" ]; then
			#It wasn't found, so lock the computer :)
			xlock -mode nose -message "Locked, because the authorised bluetooth device is not available!"
		fi
	else
		#Cannot locate the local bluetooth device, so lock the screen.
		xlock -mode nose -message "Locked, because the local bluetooth device is not available"
		#The authorised user can unlock the computer, after that I scan
                #for the local bluetooth device. If it is back I will resume
        	#the rest of the script.
		while [ $LOCAL_DEVICE_AVAILABLE == "0" ];
		do
			LOCAL_DEVICE_AVAILABLE=`hcitool device | grep -c hci`
		done
	fi
done
Želví edit: prosím příště do kódu, v citaci je to docela nanic. ;)
Jestli se dobre domnivam tak misto PLEASE FILL IN THE MAC ADDRES OF YOUR BLUETOOTH DEVICE, IE YOUR PDA/MOBILE mam vyplnit mac adresu myho founu.
Ale jaksi mi to nefunguje. Spoustim to prikazem ./nazevscriptu
Nevite co delam spatne?
			 
			
			- 
				adresu telefonu vypln do tohoto radku:
AUTHMAC="NO-MAC-DEFINED"
samozrejme mezi ty uvozovky :)
			 
			
			- 
				kdyz sem dal maca i tam tak mi to neslo
			
 
			
			- 
				BlueProximity (http://blueproximity.sourceforge.net/) vie to isté a má na stiahnutie .deb :) Kedysi som ho používal, funguje dobre, len nevie odomknúť obrazovku keď prídeš (možno už vie, skúšal som ho dosť dávno)
			
 
			
			- 
				program sem si sosnul,ale nejak mi nefunguje,mozna to je mym telefonem mam HTC kaiser.
			
 
			
			- 
				Niekde na stránke by mal byť zoznam kompatibilných zariadení... Ja som to používal s k700i.
			
 
			
			- 
				uz sem koukal a htc sem tam nenasel.