autoshutdown-plugin prevents execution of anacron after suspend

    • OMV 3.x
    • autoshutdown-plugin prevents execution of anacron after suspend

      I am using OMV in Version 3.0.31 and the autoshutdown-plugin in Version 3.1.1.
      For my Backups I am using Rsnapshot-Plugin. As my system is not running the whole day, its important to me, that the daily backup is executed once a day. So I thought anacron should be the answer. So I have added a file in "/etc/cron.daily" with the command to start anacron.
      This works just fine but only in one of the following cases:
      • booting after shutdown or restarting the system
      • wake up after the command "pm-suspend" from the terminal
      • wake up after the suspend-button in the gui was used
      • command "anacron" from terminal

      So it seams that anacron is not getting started, when the autoshutdown-plugin has put the system to "suspend"-mode. So the question ist what is different when autoshutdown initiates the "suspend"?

      What I allready have tried (without success):
      • in the file "/etc/pm/sleep.d/autoshutdown-restart" I tried to add own commands to the case "thaw|resume". But they behave just like the start of anchron, the commands are only executed in the cases listed above -> so I assume the autoshutdown-plugin uses any kind of other "suspend"-state, that isn't recognized properly by the system when it returns. Any idea how I can change this?
      • Even when I add in the GUI of the autoshutdown-plugin to the "extra options" the phrase SHUTDOWNCOMMAND="pm-suspend" this has no effect. (I read this in "/etc/autoshutdown.default")
      • when I look at the syslog ("Syslog - Suspend mit Autoshutdown.txt") I notice that anacron is started just before the system is suspended (19:37). But when I wake it up (19:46) anacron is not launched again as it should. On the other hand this works just fine in one of the cases listed above (see syslog "Syslog - Suspend mit GUI.txt"). Actually its launched even twice in one of these cases. Just before "suspend" (13:28:23) but also after waking up (13:47:52). But everytime I see the line "openmediavault autoshutdown [8231]: thaw/resume: autoshutdown-script restart from /etc/pm/sleep.d/autoshutdown-restart" in syslog. So it seams to me that "/etc/pm/sleep.d/autoshutdown-restart" is at least envolved at each wake-up-process.
      So it would be great if anyone had an idea or a suggestion I could try.

      It also would be kind of a solution if someone could tell me how I can otherwise launch a script each time the system returns from "suspend", especially if the autoshutdown-plugin has initiated it.

      The post was edited 4 times, last by Tobi90 ().

    • Never the less your question was asked quit a while ago, I would like to post my solution here. Maybe that helps others as well.

      I had the same problem. I think the root cause is that autoshutdown involves a mixture of the old pm-utils and the new systemd.

      so I edited /usr/share/openmediavault/mkconf/autoshutdown and /etc/systemd/system/ and the other relevant power (suspend and hybrid) states to update it to the new systemd files

      run then
      systemctl daemon-reloadsystemctl start autoshutdown.serviceto activate the changes after that you need to ask omv to apply the configuration

      now anacron will be run correctly

      to make sure that anacron is called often enough and also has no collisions between daily, weekly, and monthly tasks, I also edited the cron configuration, but that depends on your specific needs
      I attached my file for your convenience as an example.