Is there a dcop, or other way, to have KMail gracefully shutdown from a bash script?
I want to turn it off while nightly backups are running…
Thanks, Michael
Anno domini 2021 Wed, 4 Aug 10:20:54 -0500 Michael scripsit:
Is there a dcop, or other way, to have KMail gracefully shutdown from a bash script?
I want to turn it off while nightly backups are running…
killall -HUP kmail
Thanks, Michael ____________________________________________________ tde-users mailing list -- users@trinitydesktop.org To unsubscribe send an email to users-leave@trinitydesktop.org Web mail archive available at https://mail.trinitydesktop.org/mailman3/hyperkitty/list/users@trinitydeskto...
On Wednesday 04 August 2021 10:39:41 am Dr. Nikolaus Klepp wrote:
Anno domini 2021 Wed, 4 Aug 10:20:54 -0500
Michael scripsit:
Is there a dcop, or other way, to have KMail gracefully shutdown from a bash script?
I want to turn it off while nightly backups are running…
killall -HUP kmail
Thanks Nik!,
Yeah, that won't screw up my already screwed up KMail indexes ;)
I was kinda hoping someone on the list already knew the dcop flag that did the same thing as:
KMail Menu: File > Quit
so KMail would shutdown nicely.
What was the name of the dcop GUI thingy?
Best, Michael
said Michael:
| What was the name of the dcop GUI thingy?
kdcop -- dep
Pictures: http://www.ipernity.com/doc/depscribe/album Column: https://ofb.biz/author/dep/
Dne st 4. srpna 2021 Michael napsal(a):
Is there a dcop, or other way, to have KMail gracefully shutdown from a bash script?
I want to turn it off while nightly backups are running…
Thanks, Michael ____________________________________________________
dcop kmail MainApplication-interface quit
Cheers
On Wednesday 04 August 2021 11:13:56 am Slávek Banko wrote:
Dne st 4. srpna 2021 Michael napsal(a):
Is there a dcop, or other way, to have KMail gracefully shutdown from a bash script?
I want to turn it off while nightly backups are running…
dcop kmail MainApplication-interface quit
On Wednesday 04 August 2021 11:18:09 am dep wrote:
said Michael: | What was the name of the dcop GUI thingy?
kdcop
Thanks Slávek and dep!
Maybe a difference in language pack(s) installed (or an upper/lower case typo?)?, but between dep giving the GUI program and Slávek's command I worked out this:
dcop kmail MainApplication-Interface quit
Note: "dcop kmail.MainApplication-Interface.quit()" as implied by the kdcop GUI does not work on the command line...
I always liked dcop, if you can figure it out you can do amazing things with it (e.g. programmatically add contacts to KMail)
Since I ultimately didn’t want to quit KMail (messes up its location in the panel), I had it suspend operations until the backup was complete. Here’s the two pieces of code for anyone who’s interested:
Best All, Michael
# # KMail, stop checking mail # Don't want to quit KMail as that changes its place in the taskbar # dcop kmail MainApplication-Interface quit # To check mail # dcop kmail KMailIface checkMail # To 'pause' KMail, run both # dcop kmail KMailIface stopNetworkJobs # dcop kmail KMailIface pauseBackgroundJobs KMailOn=1 dcop kmail KMailIface stopNetworkJobs EXITCODE="$?" if [ $EXITCODE -eq 0 ] ; then dcop kmail KMailIface pauseBackgroundJobs CurrDateTime=$(date +"%y-%m-%d %H:%M:%S") echo "$CurrDateTime: KMail set offline" else CurrDateTime=$(date +"%y-%m-%d %H:%M:%S") echo "$CurrDateTime: KMail was not running?" KMailOn=0 fi
# # KMail, re-start checking mail # If KMail wasn't running, don't start it. # nice -n 2 /opt/trinity/bin/kmail & >/dev/null 2>/dev/null if [ $KMailOn -eq 1 ] ; then dcop kmail KMailIface resumeNetworkJobs dcop kmail KMailIface resumeBackgroundJobs CurrDateTime=$(date +"%y-%m-%d %H:%M:%S") echo "$CurrDateTime: KMail set online" fi
On Wednesday 04 August 2021 01:13:23 pm Michael wrote:
Since I ultimately didn’t want to quit KMail (messes up its location in the panel), I had it suspend operations until the backup was complete. Here’s the two pieces of code for anyone who’s interested:
Which had errors since it's run by cron :( Here's the debug-ed version:
# # KMail, stop checking mail # Don't want to quit KMail as that changes its place in the taskbar # dcop kmail MainApplication-Interface quit # To check mail # dcop kmail KMailIface checkMail # To 'pause' KMail, run both # dcop kmail KMailIface stopNetworkJobs # dcop kmail KMailIface pauseBackgroundJobs KMailOn=1 WhoAmI=`/usr/bin/whoami` # echo "I am: $WhoAmI" /opt/trinity/bin/dcop --user "$WhoAmI" kmail KMailIface stopNetworkJobs EXITCODE="$?" if [ $EXITCODE -eq 0 ] ; then /opt/trinity/bin/dcop --user "$WhoAmI" kmail KMailIface pauseBackgroundJobs CurrDateTime=$(date +"%y-%m-%d %H:%M:%S") echo "$CurrDateTime: KMail set offline" else CurrDateTime=$(date +"%y-%m-%d %H:%M:%S") echo "$CurrDateTime: KMail was not running?" KMailOn=0 fi
# # KMail, re-start checking mail # If KMail wasn't running, don't start it. # nice -n 2 /opt/trinity/bin/kmail & >/dev/null 2>/dev/null if [ $KMailOn -eq 1 ] ; then /opt/trinity/bin/dcop --user "$WhoAmI" kmail KMailIface resumeNetworkJobs /opt/trinity/bin/dcop --user "$WhoAmI" kmail KMailIface resumeBackgroundJobs CurrDateTime=$(date +"%y-%m-%d %H:%M:%S") echo "$CurrDateTime: KMail set online" fi