Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

hwclock: Cannot access the Hardware - crontab as root

Need help with peripherals or devices?
Post Reply
Message
Author
JPrust
Posts: 6
Joined: 2015-05-22 14:02

hwclock: Cannot access the Hardware - crontab as root

#1 Post by JPrust »

Hi, i get this error when i run the script by crontab. When I run manually, the script runs perfectly. crontab is executed by the command: "crontab -u root -e" To make sure the tasks are performed by the root user, but I still have the following error:

Code: Select all

hwclock: Cannot access the Hardware Clock via any known method.
hwclock: Use the --debug option to see the details of our search for an access method.
Erro na sincronização
Wed 02 Oct 2019 08:04:11 AM -03
This is the script:

Code: Select all

#!/bin/bash
pingtest=$(ping -c 1 a.ntp.br > /dev/null 2>&1; echo $?);

if [[ $pingtest -eq 0 ]]; then
	systohc=$(/sbin/hwclock -f /dev/rtc1 -w; echo $?);

	if [[ $systohc -eq 0 ]]; then
		echo "SINCRONIZADO: SISTEMA PARA RTC"
		date
	else
		echo "Erro na sincronizacao"
		date
	fi
else
	hctosys=$(/sbin/hwclock -f /dev/rtc1 -s; echo $?);

	if [[ $hctosys -eq 0 ]]; then
		echo "SINCRONIZADO: RTC PARA SISTEMA"
		date
	else
		echo "Erro na sincronizacao"
		date
	fi
fi
and this is the contab, config by "crontab -u root -e" command:

Code: Select all

*/30 * * * * /bin/bash /scripts/rtc/rtc.sh > /scripts/rtc/rtc.log 2>&1
@reboot /bin/bash /scripts/rtc/rtc.sh > /scripts/rtc/rtc.log 2>&1
Well, i dont understand why i got this error, if i am running the commands as root.

Post Reply