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
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.
as @lelldorin said you can put a script, or its symlink, into /boot/home/config/settings/boot/launch
the script could be something similar:
#! /bin/bash
sleep 1d && timeout 1m alert --stop --modal "Do you want to reboot your system now?" "No" "Yes" 1>/dev/null
# wait 1 day, prompt a modal alert, if confirmed or w/o an answer in 1 minute, it reboots
[ $? -ne 0 ] && shutdown -r
Sure, and it’s more elegant to do such a task using cron, “sleep” is a brutal way but using system tools without installing nothing more ( if i remember well timeout is not a bash built-in, but i think is brought within gnutils)
I put this script in the /boot/home/config/setting/boot/launch and made it executable, but for some reason the computer didn’t restart at 2:30 AM. The script is running; I checked in Terminal using “ps” command.
#!/bin/sh
while true ; do
now=$(date +%H:%M)
if [ $now == “2:30” ] ; then
echo reboot
sleep 60 # wait until it’s past 2:30
shutdown -r
fi
sleep 30
done
That one could be improved a bit but it depends on how accurate it needs to be. If the script is run after midnight then it will delay for more than 24 hours. If you need to guarantee that it reboots at 4AM then it would need a few lines.