Pi does not shut down properly

Ok I uninstalled antivirus and disabled SAMBA.
Without SAMBA the system reboots much faster and consistend. Otherwise I somtimes get 503 error after rebooting. Further when rebooting via console it’s also much faster than via web-interface. When rebooting via web-interface I noticed that SWAP goes from 0% up to 100% and takes forever to reboot. When rebooting via console the system shuts down instantly.
Strange… but I’m happy to know that SAMBA is causing this issue.

Now there is only one thing left. I can’t run my backup script via crontab.
The script is placed in: /root/scripts/backup.sh
I log in via user pi and get root rights: sudo -s
I gave it execution rights: chmod +x /root/scripts/backup.sh
I can start it manually and I get an email when the backup is finished.
In crontab -e it looks like: 0 3 * * * /root/scripts/backup.sh > /dev/null 2>&1
But crontab does not start the job.
I’ve made a test job in crontab creating a file and writing “cron is working” in it. That’s working.
In the past I had the exact same setup doing my daily backup. Don’t know whats wrong with it.
This is what syslog says:
Apr 16 03:15:01 nextcloudpi CRON[436000]: (root) CMD (/root/scripts/backup.sh > /dev/null 2>&1)

Ok to finish this:
In crontab (nano /etc/crontab not crontab -e) I have to write: 0 3 * * * bash /root/scripts/backup.sh > /dev/null 2>&1. Now it works.
For the rest:

  • Don’t restore the database without the data and try to run NC.
  • Enabling SAMBA can result in pretty long shutdown and reboot processes. Without it works much better.
  • Shutdown and reboot via SSH works much faster than via ncp-panel.

I don’t know why the last to points are a problem with my instance. But at least I know how to get around.