On Sun, 2019-06-02 at 09:14 +0100, Michelle via evolution-list wrote: > Upgraded my version of Mint, which has... > Evolution 3.28.5-0ubuntu0.18.04.1 > > Prior to upgrading Linux Mint, my evolution backup script contained the > following... > > #!/bin/sh > export DISPLAY=:0.0 > rm /mnt/tank/users/michelle/backup/mail/5.tar.gz > mv /mnt/tank/users/michelle/backup/mail/4.tar.gz > /mnt/tank/users/michelle/backup/mail/5.tar.gz > mv /mnt/tank/users/michelle/backup/mail/3.tar.gz > /mnt/tank/users/michelle/backup/mail/4.tar.gz > mv /mnt/tank/users/michelle/backup/mail/2.tar.gz > /mnt/tank/users/michelle/backup/mail/3.tar.gz > mv /mnt/tank/users/michelle/backup/mail/1.tar.gz > /mnt/tank/users/michelle/backup/mail/2.tar.gz > sleep 5 > cd ~ > /usr/lib/evolution/evolution-backup --restart --backup > /mnt/tank/users/michelle/backup/mail/1.tar.gz > > It is set to run three times a week and needed the export command to > get the shutdown to occur. > > However, on those occasions I am now waking up after the overnight > backup, to find two copies of Evolution running. With or without the > display export. > > The results form the script are as follows... > > michelle@main-desktop:~$ ./evo-backup.sh > evolution-backup-Message: 09:05:55.487: evolution --quit > evolution-backup-Message: 09:05:55.886: rm > /home/michelle/.local/share/evolution/.running > rm: cannot remove '/home/michelle/.local/share/evolution/.running': No > such file or directory > evolution-backup-Message: 09:05:55.888: dconf dump > /org/gnome/evolution-data-server/ > > /home/michelle/.local/share/evolution/backup-restore-dconf-eds.ini > evolution-backup-Message: 09:05:55.892: dconf dump > /org/gnome/evolution/ >/home/michelle/.local/share/evolution/backup- > restore-dconf-evo.ini > evolution-backup-Message: 09:05:55.908: cd /home/michelle && tar chf - > .local/share/evolution .config/evolution evolution.dir | gzip > > '/mnt/tank/users/michelle/backup/mail/1.tar.gz' > tar: .local/share/evolution: file changed as we read it > evolution-backup-Message: 09:08:07.003: rm /home/michelle/evolution.dir > > So evolution-backup is reporting the "quit" to evolution, but it > doesn't appear to be listening. Also, there never appears to be a > .running file in .local so I'm not sure what's happening. > > I've tried dropping to a command prompt and just issuing... > evolution --quit > > ... but it doesn't respond and stays running. > > Any advice please?
Hi, my advice is to think over your strategy of doing a backup. You are executing one command after the other, without even checking the exit status of a command, before you execute the next command. You try to remove '.local/share/evolution/.running', a file that doesn't exist. However, if such a file would exist, you probably would work against the purpose of the file, by just removing it, let alone that if the file would exist and if it would make sense to remove the file, you still don't test, if the file was removed successfully. After executing a command, you at least should redirect the output of "echo $?" to a log file or better let the script do something smart. However, without a smart script and without a log file, at least use '&&' between commands, so if the exit status shouldn't be 0, the next command wouldn't be executed. Even '#!/bin/sh' already could cause issues, since it not necessarily is a link against the shell you expect. I wonder what kind of setup requires to export DISPLAY? Do you run a bunch of similar scripts, that don't know about the other scripts? Btw. if you post code, consider to use Evolution's plain text editor option "Preformatted" to avoid line wrapping ;) or add the code as an attachment or at least add a '\' before a line is wrapped. I run a lot of unimportant scripts with a 'sleep n' for liely the reason you add it to your script, but I never ever would use this for an important backup script. Btw. what do you gain from 'sleep' here? I guess a command followed by 'mv' won't run, before 'mv' finished, unless you are using '&'. It still would be better to use '&&' to ensure that 'mv' not only finished, but finished successfully. Just my 2 Cents, Ralf _______________________________________________ evolution-list mailing list evolution-list@gnome.org To change your list options or unsubscribe, visit ... https://mail.gnome.org/mailman/listinfo/evolution-list