I have been using IPFire for a few years. The computer boots every day at 05:30 using the wakeup BIOS mechanism and shuts down automatically using a scheduled script at 22:30 (fcrontab). There have been no problems for a long time. But since the upgrade to core 157 I’m experiencing problems with it. Some days, randomly, the shutdown script runs about 2 minutes after system boot and shuts down the system. When that happens I simply turn on the computer manually and all is well, the system works fine. I have gone through my fcrontab file and the shutdown script only appears once, scheduled at 22.30 every day. I have no entries for the script in any of the fcron folders under /etc. I am the only user on the computer.
Any idea what is going on? Why is the script running when it is not scheduled?
Note: when I upgraded to core 157 I lost the grub configuration and had to reinstall IpFire using a backup to restore.
This is the fcrontab line: 30 22 * * * /scripts/apagado/apagado_firewall.sh
Apagado means shutdown in spanish.
This is the content of the apagado_firewall.sh (no rocket science):
#!/bin/bash
# sync time
hwclock --systohc
# send a report (uptime, disk usage, and some data more)
source /scripts/sendreports/full_report.sh
# # shutdown the firewall
/sbin/shutdown -h now
Today, this line was in my /var/logs/messages file:
Jul 28 05:32:20 wall shutdown[5188]: shutting down for system halt
And using a custom script and ps to monitor the processes I got this:
Okay, was just an idea.
If IPFire was stopped before 22:30, the scheduled task could have been executed after restart.
But your line and the sequence of events doesn’t confirm this case.
I used to use Connection Scheduler but then I needed to perform some tasks before shutdown so I switched to a script. Now I don’t need to perform those tasks anymore so I guess I could schedule sending reports and use the Connection Scheduler to shutdown the computer. I will do that if there is no other solution. However, I would like to know why this is happening, if I am doing something wrong or if it is a system problem.
Just some thoughts.
Background: If there is no (functioning) RTC the last time setting is valid at system restart. If the fetch from a time server lasts longer than the activation of fcron, old time events are executed.
The system starts at 05:30. At that time I am still sleeping But I have created a script that is launched at boot time (fcrontab, @reboot). That script runs for the first 20 minutes taking a snapshot of the running processes using the ps command every second (ps auxf). This is how I was able to display the lines:
Hi,
I’ve solved the issue simply adding a delay to the shutdown command in the apagado_firewall.sh, so the content of the script is now this:
#!/bin/bash
# sync time
hwclock --systohc
# send a report (uptime, disk usage, and some data more)
source /scripts/sendreports/full_report.sh
# # shutdown the firewall
/sbin/shutdown -h +10
I was using sendEmail for sending reports for a while. When I upgraded to core 158, sendEmail was removed so I created my own script for sending reports, using python and smtplib module. That was when the problems started.
I use my script for sending reports in others machines without any problem, and even in this IPfire machine the script works well and the reports are sent. But for some unkown reason, I think this is the source of the random problem (connection to smtp server not closed properly maybe).
How I said, adding a delay between the sent of the report and the shutdown, has soved de problem.