Scheduled auto-reboot possible for Haiku?

Hi all,

Is there a way to auto-reboot Haiku once every 24 hours? We use Haiku daily to run a radio station, but VNC and FTP connectivity is lost after Haiku has been running for a couple days or more. I’d like to have the system auto-reboot at 4 AM or so every early morning, to help remedy the problem. Thanks,
Jeff

You can install cronie from haikudepot and use it to define a job to run at a certainhour everyday. I have not done that so I can’t provide more precise instructions, sorry

Did you report your problem to the haiku bugtracker (dev.haiku-os.org) with system logs if available?

You could execute this script on bootup or put it in ~/config/settings/boot/UserBootscript. It checks every 30 seconds if it’s 4:00 o’clock and reboots if it is. Before rebooting, it waits a minute to make sure it’s past 4:00 when you’ve rebooted to avoid an immediate reboot (in case you have a fast starting machine…):

 #!/bin/sh

while true ; do
	now=$(date +%H:%M)
	if [ $now == "4:00" ] ; then
		echo reboot
		sleep 60	# wait until it's past 4:00
		shutdown -r
	fi
	sleep 30
done

Thanks guys,

I used the script and named it “autoboot”.

I’m pretty sure I opened a ticket on the connectivity problem a few years ago, or maybe it was already an open ticket I saw. The problem may have been fixed by now, I’m not sure. I wouldn’t dare attempt to update the Haiku version to a “fixed” one though, since the Tunetracker system we used was bought as a complete system and seems somewhat integrated with the Haiku system as far as I can tell.

The shutdown command can also delay the reboot if you calculate the number of seconds until 4:00. It is possible to use a command like…

#!/bin/bash
shutdown -r -d $(( `date --date '4:00 tomorrow' +%s` - `date +%s` ))
3 Likes

Oh, even nicer! :slight_smile: