[Evolution] Unable to launch Evolution from a cron job
Hi Evolution enthusiasts, I've exhausted what I can find on the web and am looking for some guidance. I'm running Evolution 3.36.4 on a MINT 20.1 system. I am trying to perform nightly backups by running the "evolution-backup" utility in a script called by cron. When this script is run from command line (as my normal user), everything works great and evolution restarts after the backup. However, when run from cron (as my normal user, not root), I can see that the evolution shutdown works great and that the file backup also works. But, Evolution does not restart again irrespective of whether the --restart option is used or not. Key elements in my script: # create a timestamped name for the backup file BACKUPFOLDER="/mnt/backup_disk2/evolution_email_on_beeker/" BACKUPFILE="$BACKUPFOLDER$(date +%F)-evolution-darrell.tar.gz" touch $BACKUPFOLDER"cron-backup-started" # # to get a clean backup shutdown evolution first evolution --force-shutdown # # perform the actual backup /usr/libexec/evolution/evolution-backup --restart --backup $BACKUPFILE touch $BACKUPFOLDER"cron-backup-finished" # I also tried restarting it with evolution & disown evolution nohup evolution > /dev/null 2>&1 and neither of them work either in cron but work fine in the script when run from command line. I'm not a Linux expert and am perplexed by this behaviour. It would seem that some critical information needed to restart is getting lost. But, this is only the case running from cron. From command line all is good. Any ideas anyone? Thanks in advance, Darrell ... PS - this is my first post to this list and apologize in advance for incorrect formatting or protocol. ___ evolution-list mailing list evolution-list@gnome.org To change your list options or unsubscribe, visit ... https://mail.gnome.org/mailman/listinfo/evolution-list
Re: [Evolution] Unable to launch Evolution from a cron job
On Wed, 2021-03-17 at 15:56 -0500, Darrell Barabash wrote: > It would seem that some critical information needed to restart is getting > lost. > But, this is only the case running from cron. From command line all is good. My immediate guess is that cron doesn't know what X display to put evolution onto. As a general troubleshooting step, you can append " >> /path/to/a/log/file.log 2&>1" to your cron job line in order to log any output from the operation. Regardless of my guess above, this should give you some more information to try to figure out what's tripping it up. Example: 0 18 * * * /path/to/your/script.sh >> /path/to/a/log/file.log 2&>1 ___ evolution-list mailing list evolution-list@gnome.org To change your list options or unsubscribe, visit ... https://mail.gnome.org/mailman/listinfo/evolution-list
Re: [Evolution] Unable to launch Evolution from a cron job
On Wed, 2021-03-17 at 15:56 -0500, Darrell Barabash wrote: > I've exhausted what I can find on the web and am looking for some > guidance. I'm running Evolution 3.36.4 on a MINT 20.1 system. I am > trying to perform nightly backups by running the "evolution-backup" > utility in a script called by cron. > > When this script is run from command line (as my normal user), > everything works great and evolution restarts after the backup. > > However, when run from cron (as my normal user, not root), I can see > that the evolution shutdown works great and that the file backup also > works. But, Evolution does not restart again irrespective of whether > the --restart option is used or not. Don't do that. Evolution is not designed to be run as a batch job. It expects to have a DISPLAY, which a cron job will not have. This is just not going to work. The wider problem is that (once again) we have to reiterate that evolution-backup, contrary to its name, *is not for taking periodic backups of Evolution data*. Its purpose is to help when moving accounts to a new machine, and it's designed to be run from the GUI (or at least from a user terminal). If you need to take a backup of Evolution, just use your normal user account backup system. Everything you need is already in your user account. That's all you have to do. I've said it before but I'll say it again: Evolution backup really needs to be called something else. poc ___ evolution-list mailing list evolution-list@gnome.org To change your list options or unsubscribe, visit ... https://mail.gnome.org/mailman/listinfo/evolution-list
Re: [Evolution] Unable to launch Evolution from a cron job
On Wed, 2021-03-17 at 16:20 -0500, Matt Connell wrote: > My immediate guess is that cron doesn't know what X display to put > evolution onto. SOLVED and thank you Matt. This was exactly the issue. I simply added "export DISPLAY=:0.0" at the beginning of the cron script and problem was solved. That also let me use "notify-send" to put up a warning before shutting down. But, I'll probably put this on the back-burner. Regardless, I learned a very valuable lesson here for running cron scripts and do appreciate the lesson. On Wed, 2021-03-17 at 22:22 +, Patrick O'Callaghan wrote: > The wider problem is that (once again) we have to reiterate that > evolution-backup, contrary to its name, *is not for taking periodic > backups of Evolution data*. Its purpose is to help when moving > accounts to a new machine, and it's designed to be run from the GUI > (or at least from a user terminal). If you need to take a backup of > Evolution, just use your normal user account backup system. > Everything you need is already in your user account. That's all you > have to do. Thanks for that sage advice Patrick. I was trying to just automate the "backup" button but understand that is not necessary nor desired. I presume that in the case of needing a restoration, it would be sufficient to simply restore the .local/share/evolution and the .config/evolution folders? Thanks for the help! Darrell ___ evolution-list mailing list evolution-list@gnome.org To change your list options or unsubscribe, visit ... https://mail.gnome.org/mailman/listinfo/evolution-list
Re: [Evolution] Unable to launch Evolution from a cron job
On Wed, 2021-03-17 at 21:31 -0500, Darrell Barabash wrote: > On Wed, 2021-03-17 at 16:20 -0500, Matt Connell wrote: > > My immediate guess is that cron doesn't know what X display to put > > evolution onto. > > SOLVED and thank you Matt. > > This was exactly the issue. I simply added "export DISPLAY=:0.0" at > the > beginning of the cron script and problem was solved. That also let me > use "notify-send" to put up a warning before shutting down. > > But, I'll probably put this on the back-burner. Regardless, I learned > a > very valuable lesson here for running cron scripts and do appreciate > the lesson. > > On Wed, 2021-03-17 at 22:22 +, Patrick O'Callaghan wrote: > > The wider problem is that (once again) we have to reiterate that > > evolution-backup, contrary to its name, *is not for taking periodic > > backups of Evolution data*. Its purpose is to help when moving > > accounts to a new machine, and it's designed to be run from the GUI > > (or at least from a user terminal). If you need to take a backup of > > Evolution, just use your normal user account backup system. > > Everything you need is already in your user account. That's all you > > have to do. > > Thanks for that sage advice Patrick. I was trying to just automate > the > "backup" button but understand that is not necessary nor desired. I > presume that in the case of needing a restoration, it would be > sufficient to simply restore the .local/share/evolution and the > .config/evolution folders? In principle, yes. As regards restoring the messages, I prefer to keep everything on an IMAP server, but that's up to you. Restoring those folders should work either way. poc ___ evolution-list mailing list evolution-list@gnome.org To change your list options or unsubscribe, visit ... https://mail.gnome.org/mailman/listinfo/evolution-list