-1

I use the following crontab to regularly reboot my system

30 5 * * * root root reboot

but after these scheduled reboots, some services don't automatically start. The ones I have noticed already are OpenVPN and PostgreSQL, but I expect there to be more. Firstly, I noticed this after adding the scheduled reboot but as I recently upgraded from 15.10, it could be that something went wrong during the upgrade.

I hope someone can tell me, a) what I did wrong or/and b) what may have caused this.

2 Answers2

1

A) Daily server reboots are wrong. Other than that, the proper way to restart is shutdown -r now, which properly shuts down services on the server and then reboots.

B) Using reboot to reboot the server does not shutdown services, so those might end up in unstable state and therefore refuse to start.

Tero Kilkanen
  • 38,887
1

There might be an issue regarding the autostart of the daemons with which you are experiencing problems.

The correct behaviour depends on the init system used. It is not perfectly clear which one you are using. Since you upgraded to Ubuntu 15.10 systemd should be the default, but you are mentioning /etc/init.d and this would point to System-V style init scripts which are a bit different.

systemd

First you should check that the service has the correct systemd init script under /etc/systemd/system/multi-user.target.wants/{service}.service

Then you can enable the service by issueing the command:

$ sudo systemctl enable {service}.service

System V

Check the runlevel your system boots into when a maintenance reboot is done

$ runlevel

Check whether the service has a functioning bash script under /etc/init.d/{service}

Then enable the service on boot:

$ update-rc.d {service} enable
pacey
  • 3,853