In diesem Artikel ist ein einfaches Skript beschrieben wie die Uhrzeit eines Mobiltelefons mit dem PC synchronisiert werden kann.
Die Kommunikation mit dem Mobiltelefon mittels gnokii muss bereits konfiguriert sein. Detailliert wird das in diesem Artikel beschrieben.
Weiters sollte die Uhrzeit des PC mittels NTP korrekt eingestellt sein. Eine Anleitung für Debian gibt es hier.
Das Skript setzt die Zeit des Handys auf die Uhrzeit des Rechners.
Über einen Parameter kann eine alternative Konfigurationsdatei für gnokii angegeben werden. Dadurch ist es möglich die Zeit auf verschiedenen Handys einzustellen.
#!/bin/bash # Copyright by Michael Mayer # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. if [ $# = 0 ]; then gnokii --setdatetime $(date +'%Y %m %d %H %M') else if [ -e $1 ]; then gnokii --config $1 --setdatetime $(date +'%Y %m %d %H %M') else echo "Fehler! Die Konfigurationsdatei konnte nicht gefunden werden." fi fi
Das oben gelistete Script kann hier als tar-Archiv heruntergeladen werden.
Diskussion