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